Updated
[blackcat] L2 Ehlers Universal Oscillator

Level: 2
Background
John F. Ehlers introuced Universal Oscillator in Jan, 2015.
Function
In “Whiter Is Brighter”, in Jan 2015, John Ehlers presented a new indicator he calls the universal oscillator. It is based on his theory that market data resembles pink noise, or as he puts it, “noise with memory.” It could be used to create a short-term trading strategy. I modified it a little bit by changing the scan criteria that is met when the universal oscillator crosses above or below a pair of threshold values e.g. +/- 0.85. Therefore, a straightforward short-term (small time scale) countertrend system could, for example, use the following rules:
## Cover your short position and go long when the universal oscillator crosses below zero or a overbought/oversold threholds e.g. +/- 0.85; sell and go short when the universal oscillator crosses above zero or a overbought threhold e.g. + 0.85.
Since it is really a universal oscillator, the indicator can power up a trend-trading system just as easily:
## Buy when the long-term universal oscillator crosses above zero or a oversold threshold e.g. - 0.85.
## Sell when the long-term universal oscillator crosses below zero or a overbought threshold e.g. 0.85.
Key Signal
Universal --> Universal Oscillator signal
long ---> long entry signal
short ---> short entry signal
Pros and Cons
99% John F. Ehlers definition translation, even variable names are the same. This help readers who would like to use pine to read his book.
Remarks
The 83th script for Blackcat1402 John F. Ehlers Week publication.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
Background
John F. Ehlers introuced Universal Oscillator in Jan, 2015.
Function
In “Whiter Is Brighter”, in Jan 2015, John Ehlers presented a new indicator he calls the universal oscillator. It is based on his theory that market data resembles pink noise, or as he puts it, “noise with memory.” It could be used to create a short-term trading strategy. I modified it a little bit by changing the scan criteria that is met when the universal oscillator crosses above or below a pair of threshold values e.g. +/- 0.85. Therefore, a straightforward short-term (small time scale) countertrend system could, for example, use the following rules:
## Cover your short position and go long when the universal oscillator crosses below zero or a overbought/oversold threholds e.g. +/- 0.85; sell and go short when the universal oscillator crosses above zero or a overbought threhold e.g. + 0.85.
Since it is really a universal oscillator, the indicator can power up a trend-trading system just as easily:
## Buy when the long-term universal oscillator crosses above zero or a oversold threshold e.g. - 0.85.
## Sell when the long-term universal oscillator crosses below zero or a overbought threshold e.g. 0.85.
Key Signal
Universal --> Universal Oscillator signal
long ---> long entry signal
short ---> short entry signal
Pros and Cons
99% John F. Ehlers definition translation, even variable names are the same. This help readers who would like to use pine to read his book.
Remarks
The 83th script for Blackcat1402 John F. Ehlers Week publication.
Readme
In real life, I am a prolific inventor. I have successfully applied for more than 60 international and regional patents in the past 12 years. But in the past two years or so, I have tried to transfer my creativity to the development of trading strategies. Tradingview is the ideal platform for me. I am selecting and contributing some of the hundreds of scripts to publish in Tradingview community. Welcome everyone to interact with me to discuss these interesting pine scripts.
The scripts posted are categorized into 5 levels according to my efforts or manhours put into these works.
Level 1 : interesting script snippets or distinctive improvement from classic indicators or strategy. Level 1 scripts can usually appear in more complex indicators as a function module or element.
Level 2 : composite indicator/strategy. By selecting or combining several independent or dependent functions or sub indicators in proper way, the composite script exhibits a resonance phenomenon which can filter out noise or fake trading signal to enhance trading confidence level.
Level 3 : comprehensive indicator/strategy. They are simple trading systems based on my strategies. They are commonly containing several or all of entry signal, close signal, stop loss, take profit, re-entry, risk management, and position sizing techniques. Even some interesting fundamental and mass psychological aspects are incorporated.
Level 4 : script snippets or functions that do not disclose source code. Interesting element that can reveal market laws and work as raw material for indicators and strategies. If you find Level 1~2 scripts are helpful, Level 4 is a private version that took me far more efforts to develop.
Level 5 : indicator/strategy that do not disclose source code. private version of Level 3 script with my accumulated script processing skills or a large number of custom functions. I had a private function library built in past two years. Level 5 scripts use many of them to achieve private trading strategy.
Release Notes
OVERVIEW This indicator implements the Ehlers Universal Oscillator, a momentum-based tool designed to identify potential market turning points through advanced signal processing techniques.FEATURES
• Advanced signal processing using the Ehlers Universal Oscillator algorithm
• Automatic gain control for consistent signal strength
• Clear visual indicators with color-coded plots
• Built-in BUY/SELL signals displayed as labels
• Customizable BandEdge parameter for adjusting sensitivity
HOW TO USE
Add the indicator to your chart
Adjust the BandEdge parameter (default 21) to fine-tune sensitivity
Monitor the oscillator line crossing: • Below -0.85 for potential buy signals • Above 0.85 for potential sell signals
PLOT INTERPRETATION
• Yellow line indicates upward trend momentum
• Fuchsia line indicates downward trend momentum
• Horizontal lines at ±0.85 mark key signal thresholds
• BUY/SELL labels appear at significant crossover points
LIMITATIONS
• Works best on longer timeframes
• May generate false signals during sideways markets
• Requires proper parameter tuning for optimal results
NOTES
• The indicator uses advanced filtering techniques for noise reduction
• Signals are generated through automatic gain control for consistent performance
• Backtesting recommended before live trading
Release Notes
█ OVERVIEWThis open-source strategy turns the classic Ehlers Super Smooth Stochastic oscillator into a complete trading system with long and short entries, signal-based exits, ATR-based risk management, and close-confirmed alerts. Every added module can be switched off to reproduce the original band-crossing behavior.
█ STRATEGY CONCEPT
The core oscillator applies John Ehlers' two-stage filtering to price: a high-pass filter removes cycles shorter than 48 bars, a SuperSmoother suppresses residual noise, and the filtered value is converted into a stochastic scaled 0-1 across the lookback window, then smoothed once more. The result is a low-lag, low-noise oscillator that crosses fixed oversold and overbought bands far more cleanly than a raw stochastic.
Signal Governance
• A position state machine (flat / long / short) arbitrates every signal, so entries and exits can never contradict each other
• Opposite crossings re-enter in the reverse direction instead of firing duplicate signals while a position is open
• A configurable cooldown suppresses whipsaw re-firing in ranging markets
• Same-bar exclusivity gives exit priority when entry and exit conditions collide
█ ENTRY CONDITIONS
Long Entry
• The smoothed stochastic crosses under the OS Level band (default 0.2)
Short Entry
• The smoothed stochastic crosses over the OB Level band (default 0.8)
• Short trades can be disabled entirely for spot-only accounts
█ EXIT CONDITIONS
Signal Exit
• An opposite band crossing closes the current position and reverses
ATR Exit
• Each fill arms a stop loss and take profit derived from ATR at entry:
1 — Stop Loss = entry price - direction x SL Multiplier x ATR (default 2 x ATR)
2 — Take Profit = entry price + direction x TP Multiplier x ATR (default 3 x ATR)
• Both levels are shown in the Data Window while a position is open
█ RISK MANAGEMENT
• Default order size is 95% of equity; the strategy models 0.1% commission and 2 ticks of slippage so backtest results stay realistic
• Stop distance scales with volatility through ATR, keeping per-trade risk comparable across symbols and timeframes
• Disable Use ATR Take Profit / Stop Loss to trade on raw signal exits only
█ RECOMMENDED SETTINGS
• Timeframes: 15-minute and above; the built-in filter constants suit intraday-to-daily charts
• Markets: crypto, forex, indices, and liquid equities
• Ranging symbols: raise Cooldown Bars or widen the OB / OS bands before trusting results
• Trending symbols: keep both band crossings enabled and consider a larger TP Multiplier
█ FEATURES
• BUY / SELL labels on entries and orange XL / XS crosses on signal exits
• Green and red background tint showing the live position state (toggleable)
• Status dashboard: position, oscillator value, and cooldown countdown (toggleable)
• Close-confirmed alert messages for entries and exits
• Threshold lines stay in sync with the OB / OS Level inputs
█ LIMITATIONS
• Band-crossing systems naturally lose money in prolonged ranges; the cooldown reduces but does not remove whipsaw
• The internal filter constants (48-bar high-pass, 10-bar SuperSmoother) are fixed to Ehlers' original values
• TP / SL prices are captured on the signal bar close; large gaps can fill beyond the intended levels
• Orders are processed on bar close, so fills assume close-of-bar prices
════════════════════════════════════════════════════════════════════════
DISCLAIMER
Past performance is not indicative of future results.
This strategy is for educational purposes only.
Always backtest thoroughly before live trading.
Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq My new github for more pine development soon: github.com/wxt-coder
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Don't miss out! The first and most important thing to do is to join my Discord chat now! Click here to start your adventure: discord.com/invite/ZTGpQJq My new github for more pine development soon: github.com/wxt-coder
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.