█ OVERVIEW
Reflex and Trendflex are zero-lag oscillators that decompose price into independent cycle and trend components using SuperSmoother filtering. These indicators isolate each component separately, providing clearer identification of cyclical reversals (Reflex) versus trending movements (Trendflex).
Based on Dr. John F. Ehlers' "Reflex: A New Zero-Lag Indicator" article (February 2020, TASC), both oscillators use normalized slope deviation analysis to minimize lag while maintaining signal clarity. The SuperSmoother filter removes high-frequency noise, then deviations from linear regression (Reflex) or current value (Trendflex) are measured and normalized by RMS for consistent amplitude across instruments and timeframes.
█ CONCEPTS
SuperSmoother Filter
Both oscillators begin with a two-pole Butterworth low-pass filter that smooths price data without the excessive lag of simple moving averages. The filter uses exponential decay coefficients and cosine modulation based on the cutoff period, providing aggressive smoothing while preserving signal timing.
Reflex: Cycle Component
Reflex isolates cyclical price behavior by measuring deviation from a linear regression line fitted through the SuperSmoother output. For each bar, the filter calculates a linear slope over the lookback period, then sums how much the smoothed price deviates from this trendline. These deviations represent pure cyclical movement - price oscillations around the dominant trend. The result is normalized by RMS (root mean square) to produce consistent amplitude regardless of volatility or timeframe.
Trendflex: Trend Component
Trendflex extracts trending behavior by measuring cumulative deviation from the current SuperSmoother value. Instead of comparing to a regression line, it simply sums the differences between the current smoothed value and all past values in the period. This captures sustained directional movement rather than oscillations. Like Reflex, normalization by RMS ensures comparable readings across different instruments.
RMS Normalization
Both oscillators normalize their raw deviation measurements using an exponentially weighted RMS calculation: `rms = 0.04 * deviation² + 0.96 * rms[1]`. This adaptive normalization ensures the oscillator amplitude remains stable as volatility changes, making threshold levels meaningful across different market conditions.
█ INTERPRETATION
Reflex (Cycle Component)
Oscillates around zero representing cyclical price behavior isolated from trend:
• Above zero: Price is in upward phase of cycle
• Below zero: Price is in downward phase of cycle
• Zero crossings: Potential cycle reversal points
• Extremes: Indicate stretched cyclical condition, often precede mean reversion
Best used for identifying cyclical turning points in ranging or oscillating markets. More sensitive to reversals than Trendflex.
Trendflex (Trend Component)
Oscillates around zero representing trending behavior isolated from cycles:
• Above zero: Sustained upward trend
• Below zero: Sustained downward trend
• Zero crossings: Trend direction changes
• Magnitude: Strength of trend (larger absolute values = stronger trend)
Best used for confirming trend direction and identifying trend exhaustion. Less noisy than Reflex due to focus on directional movement rather than oscillations.
Combined Analysis
Using both oscillators together provides powerful signal confirmation:
• Both positive: Strong uptrend with positive cycle phase (high probability long setup)
• Both negative: Strong downtrend with negative cycle phase (high probability short setup)
• Divergent signals: Conflicting cycle and trend (choppy conditions, reduce position size)
• Reflex reversal with Trendflex agreement: Cyclical turn within established trend (entry/exit timing)
Dynamic Thresholds
Threshold bands identify statistically significant oscillator readings that warrant attention:
• Breach above +threshold: Strong bullish cycle (Reflex) or trend (Trendflex) behavior - potential overbought condition
• Breach below -threshold: Strong bearish cycle or trend behavior - potential oversold condition
• Return inside thresholds: Signal strength normalizing, potential reversal or consolidation ahead
• Threshold compression: During low volatility, thresholds narrow (especially with StdDev mode), making breaches more frequent
• Threshold expansion: During high volatility, thresholds widen, filtering out minor oscillations
Combine threshold breaches with zero-line position for stronger signals:
• Threshold breach + zero-line cross = high-conviction signal
• Threshold breach without zero-line support = monitor for confirmation
Alert Conditions
Six built-in alerts trigger on bar close (no repainting):
• Above +Threshold: Oscillator crossed above positive threshold (strong bullish behavior)
• Below -Threshold: Oscillator crossed below negative threshold (strong bearish behavior)
• Reflex Above Zero: Reflex crossed above zero (bullish cycle phase)
• Reflex Below Zero: Reflex crossed below zero (bearish cycle phase)
• Trendflex Above Zero: Trendflex crossed above zero (bullish trend shift)
• Trendflex Below Zero: Trendflex crossed below zero (bearish trend shift)
█ SETTINGS & PARAMETER TUNING
Oscillator Settings
• Source: Price series to decompose
• Reflex Period (5-50): SuperSmoother period for cycle component. Lower values increase responsiveness to cyclical turns but add noise. Default 20.
• Trendflex Period (5-50): SuperSmoother period for trend component. Lower values respond faster to trend changes. Default 20.
Display Settings
• Reflex/Trendflex Display: Toggle visibility and customize colors for each oscillator independently
• Zero Line: Reference line showing neutral oscillator position
Dynamic Thresholds
Optional significance bands that identify when oscillator readings indicate strong cyclical or trending behavior:
• Threshold Mode: Choose calculation method based on market characteristics
- MAD (Median Absolute Deviation): Outlier-resistant, best for markets with occasional spikes (default)
- Standard Deviation: Volatility-sensitive, adapts quickly to regime changes
- Percentile Rank: Fixed probability bands (e.g., 90% = only 10% of values exceed threshold)
• Apply To: Select which oscillator (Reflex or Trendflex) to calculate thresholds for
• Period (2-200): Lookback window for threshold calculation. Default 50.
• Multiplier (k): Scaling factor for MAD/StdDev modes. Higher values = fewer threshold breaches (default 1.5)
• Percentile (%): For Percentile mode only. Higher percentile = more selective threshold (default 90%)
Parameter Interactions
• Shorter periods make both oscillators more sensitive but noisier
• Reflex typically more volatile than Trendflex at same period settings
• For ranging markets: shorter Reflex period (10-15) captures swings better
• For trending markets: shorter Trendflex period (10-15) follows trend shifts faster
█ LIMITATIONS
Inherent Characteristics
• Near-zero lag, not zero-lag: Despite the name, some lag remains from SuperSmoother filtering
• Normalization artifacts: RMS normalization can produce unusual readings during volatility regime changes
• Period dependency: Oscillator characteristics change significantly with different period settings - no "correct" universal parameter
Market Conditions to Avoid
• Very low volatility: Normalization amplifies noise in quiet markets, producing false signals
• Sudden gaps: SuperSmoother assumes continuous data; large gaps disrupt filter continuity requiring bars to stabilize
• Micro timeframes: Sub-minute charts contain microstructure noise that overwhelms signal quality
Parameter Selection Pitfalls
• Matching periods to dominant cycle: If period doesn't align with actual market cycle period, signals degrade
• Threshold over-tuning: Optimizing threshold parameters for past data often fails forward - use conservative defaults
• Ignoring component differences: Reflex and Trendflex measure different aspects - don't expect identical behavior
█ NOTES
Credits
These indicators are based on Dr. John F. Ehlers' "Reflex: A New Zero-Lag Indicator" published in the February 2020 issue of Technical Analysis of Stocks & Commodities (TASC) magazine. The article introduces a novel approach to isolating cycle and trend components using SuperSmoother filtering combined with normalized deviation analysis.
For those interested in the underlying mathematics and DSP concepts:
• Ehlers, J.F. (February 2020). "Reflex: A New Zero-Lag Indicator" - Technical Analysis of Stocks & Commodities magazine
• Ehlers, J.F. (2001). Rocket Science for Traders: Digital Signal Processing Applications. John Wiley & Sons
• Various TASC articles by John Ehlers on SuperSmoother filters and oscillator design
by ♚e2e4
Reflex and Trendflex are zero-lag oscillators that decompose price into independent cycle and trend components using SuperSmoother filtering. These indicators isolate each component separately, providing clearer identification of cyclical reversals (Reflex) versus trending movements (Trendflex).
Based on Dr. John F. Ehlers' "Reflex: A New Zero-Lag Indicator" article (February 2020, TASC), both oscillators use normalized slope deviation analysis to minimize lag while maintaining signal clarity. The SuperSmoother filter removes high-frequency noise, then deviations from linear regression (Reflex) or current value (Trendflex) are measured and normalized by RMS for consistent amplitude across instruments and timeframes.
█ CONCEPTS
SuperSmoother Filter
Both oscillators begin with a two-pole Butterworth low-pass filter that smooths price data without the excessive lag of simple moving averages. The filter uses exponential decay coefficients and cosine modulation based on the cutoff period, providing aggressive smoothing while preserving signal timing.
Reflex: Cycle Component
Reflex isolates cyclical price behavior by measuring deviation from a linear regression line fitted through the SuperSmoother output. For each bar, the filter calculates a linear slope over the lookback period, then sums how much the smoothed price deviates from this trendline. These deviations represent pure cyclical movement - price oscillations around the dominant trend. The result is normalized by RMS (root mean square) to produce consistent amplitude regardless of volatility or timeframe.
Trendflex: Trend Component
Trendflex extracts trending behavior by measuring cumulative deviation from the current SuperSmoother value. Instead of comparing to a regression line, it simply sums the differences between the current smoothed value and all past values in the period. This captures sustained directional movement rather than oscillations. Like Reflex, normalization by RMS ensures comparable readings across different instruments.
RMS Normalization
Both oscillators normalize their raw deviation measurements using an exponentially weighted RMS calculation: `rms = 0.04 * deviation² + 0.96 * rms[1]`. This adaptive normalization ensures the oscillator amplitude remains stable as volatility changes, making threshold levels meaningful across different market conditions.
█ INTERPRETATION
Reflex (Cycle Component)
Oscillates around zero representing cyclical price behavior isolated from trend:
• Above zero: Price is in upward phase of cycle
• Below zero: Price is in downward phase of cycle
• Zero crossings: Potential cycle reversal points
• Extremes: Indicate stretched cyclical condition, often precede mean reversion
Best used for identifying cyclical turning points in ranging or oscillating markets. More sensitive to reversals than Trendflex.
Trendflex (Trend Component)
Oscillates around zero representing trending behavior isolated from cycles:
• Above zero: Sustained upward trend
• Below zero: Sustained downward trend
• Zero crossings: Trend direction changes
• Magnitude: Strength of trend (larger absolute values = stronger trend)
Best used for confirming trend direction and identifying trend exhaustion. Less noisy than Reflex due to focus on directional movement rather than oscillations.
Combined Analysis
Using both oscillators together provides powerful signal confirmation:
• Both positive: Strong uptrend with positive cycle phase (high probability long setup)
• Both negative: Strong downtrend with negative cycle phase (high probability short setup)
• Divergent signals: Conflicting cycle and trend (choppy conditions, reduce position size)
• Reflex reversal with Trendflex agreement: Cyclical turn within established trend (entry/exit timing)
Dynamic Thresholds
Threshold bands identify statistically significant oscillator readings that warrant attention:
• Breach above +threshold: Strong bullish cycle (Reflex) or trend (Trendflex) behavior - potential overbought condition
• Breach below -threshold: Strong bearish cycle or trend behavior - potential oversold condition
• Return inside thresholds: Signal strength normalizing, potential reversal or consolidation ahead
• Threshold compression: During low volatility, thresholds narrow (especially with StdDev mode), making breaches more frequent
• Threshold expansion: During high volatility, thresholds widen, filtering out minor oscillations
Combine threshold breaches with zero-line position for stronger signals:
• Threshold breach + zero-line cross = high-conviction signal
• Threshold breach without zero-line support = monitor for confirmation
Alert Conditions
Six built-in alerts trigger on bar close (no repainting):
• Above +Threshold: Oscillator crossed above positive threshold (strong bullish behavior)
• Below -Threshold: Oscillator crossed below negative threshold (strong bearish behavior)
• Reflex Above Zero: Reflex crossed above zero (bullish cycle phase)
• Reflex Below Zero: Reflex crossed below zero (bearish cycle phase)
• Trendflex Above Zero: Trendflex crossed above zero (bullish trend shift)
• Trendflex Below Zero: Trendflex crossed below zero (bearish trend shift)
█ SETTINGS & PARAMETER TUNING
Oscillator Settings
• Source: Price series to decompose
• Reflex Period (5-50): SuperSmoother period for cycle component. Lower values increase responsiveness to cyclical turns but add noise. Default 20.
• Trendflex Period (5-50): SuperSmoother period for trend component. Lower values respond faster to trend changes. Default 20.
Display Settings
• Reflex/Trendflex Display: Toggle visibility and customize colors for each oscillator independently
• Zero Line: Reference line showing neutral oscillator position
Dynamic Thresholds
Optional significance bands that identify when oscillator readings indicate strong cyclical or trending behavior:
• Threshold Mode: Choose calculation method based on market characteristics
- MAD (Median Absolute Deviation): Outlier-resistant, best for markets with occasional spikes (default)
- Standard Deviation: Volatility-sensitive, adapts quickly to regime changes
- Percentile Rank: Fixed probability bands (e.g., 90% = only 10% of values exceed threshold)
• Apply To: Select which oscillator (Reflex or Trendflex) to calculate thresholds for
• Period (2-200): Lookback window for threshold calculation. Default 50.
• Multiplier (k): Scaling factor for MAD/StdDev modes. Higher values = fewer threshold breaches (default 1.5)
• Percentile (%): For Percentile mode only. Higher percentile = more selective threshold (default 90%)
Parameter Interactions
• Shorter periods make both oscillators more sensitive but noisier
• Reflex typically more volatile than Trendflex at same period settings
• For ranging markets: shorter Reflex period (10-15) captures swings better
• For trending markets: shorter Trendflex period (10-15) follows trend shifts faster
█ LIMITATIONS
Inherent Characteristics
• Near-zero lag, not zero-lag: Despite the name, some lag remains from SuperSmoother filtering
• Normalization artifacts: RMS normalization can produce unusual readings during volatility regime changes
• Period dependency: Oscillator characteristics change significantly with different period settings - no "correct" universal parameter
Market Conditions to Avoid
• Very low volatility: Normalization amplifies noise in quiet markets, producing false signals
• Sudden gaps: SuperSmoother assumes continuous data; large gaps disrupt filter continuity requiring bars to stabilize
• Micro timeframes: Sub-minute charts contain microstructure noise that overwhelms signal quality
Parameter Selection Pitfalls
• Matching periods to dominant cycle: If period doesn't align with actual market cycle period, signals degrade
• Threshold over-tuning: Optimizing threshold parameters for past data often fails forward - use conservative defaults
• Ignoring component differences: Reflex and Trendflex measure different aspects - don't expect identical behavior
█ NOTES
Credits
These indicators are based on Dr. John F. Ehlers' "Reflex: A New Zero-Lag Indicator" published in the February 2020 issue of Technical Analysis of Stocks & Commodities (TASC) magazine. The article introduces a novel approach to isolating cycle and trend components using SuperSmoother filtering combined with normalized deviation analysis.
For those interested in the underlying mathematics and DSP concepts:
• Ehlers, J.F. (February 2020). "Reflex: A New Zero-Lag Indicator" - Technical Analysis of Stocks & Commodities magazine
• Ehlers, J.F. (2001). Rocket Science for Traders: Digital Signal Processing Applications. John Wiley & Sons
• Various TASC articles by John Ehlers on SuperSmoother filters and oscillator design
by ♚e2e4
Notas de Lançamento
Refactor to v6: optimize loops, remove divs, replace threshold bands, add alertsScript de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Pisces swimming through the river
All their life against the stream
Searching for a hook to catch on
And see their sun beam
Then suffocate in painful tortures
On cutting tables of callous men
Under a knife of handsome butchers
Emeralds are ripped away
All their life against the stream
Searching for a hook to catch on
And see their sun beam
Then suffocate in painful tortures
On cutting tables of callous men
Under a knife of handsome butchers
Emeralds are ripped away
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Pisces swimming through the river
All their life against the stream
Searching for a hook to catch on
And see their sun beam
Then suffocate in painful tortures
On cutting tables of callous men
Under a knife of handsome butchers
Emeralds are ripped away
All their life against the stream
Searching for a hook to catch on
And see their sun beam
Then suffocate in painful tortures
On cutting tables of callous men
Under a knife of handsome butchers
Emeralds are ripped away
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
