[blackcat] L3 Ehlers DFT-Adapted RSI

The [blackcat] L3 Ehlers DFT-Adapted RSI is an advanced technical indicator that combines Digital Fourier Transform (DFT) analysis with traditional RSI calculations to provide enhanced market trend identification and trading signals.
FEATURES
• DFT-based frequency analysis of price movements
• Adaptive RSI calculation using dominant cycle detection
• Fast and slow moving average lines
• Color-coded candlestick visualization
• Horizontal reference lines at 45 and 55
• Intelligent sideways detection and label management
• Customizable parameter inputs
HOW TO USE
Configure the following inputs:
• Price source (default: HL2)
• Window size (default: 50)
• Overbought threshold (default: 70)
• Oversold threshold (default: 30)
• Fraction multiplier (default: 0.5)
Interpret the indicator:
• Yellow candles indicate bullish momentum
• Fuchsia candles indicate bearish momentum
• Crosses between fast and slow lines suggest potential trend changes
• Position relative to the 45/55 lines indicates overall market sentiment
• Labels appear only when sideways conditions break
SIDESWAYS DETECTION
• Sideways conditions are identified when:
The difference between fast and slow lines is less than 0.5
Both lines show minimal movement (< 0.1) • During sideways periods:
Existing labels are removed
No new labels are generated • When sideways ends:
If trend reverses, opposite label is generated
If trend continues, no new label is created
LIMITATIONS
• Requires sufficient historical data for accurate calculations
• Performance may vary across different market conditions
• Parameter sensitivity requires careful calibration
NOTES
• The indicator uses Ehlers' proprietary DFT methodology
• Default settings are optimized for general market conditions
• Consider adjusting parameters based on your trading timeframe and strategy
The DFT-Adapted RSI was first introduced by John F. Ehlers in January 2007 as part of his groundbreaking work in Fourier Transforms for Traders. This indicator represents a significant advancement over traditional RSI by incorporating dynamic parameter adjustment based on detected market cycles. Instead of using a fixed period length, it employs discrete Fourier transform (DFT) techniques to determine the optimal cycle length for each bar, thereby enhancing the indicator's responsiveness to changing market conditions.
FUNCTIONALITY DEPTH
At its core, this script implements three key components derived from Ehlers' methodology:
Cycle Detection Engine
Analyses price data using a sliding window (default 50 bars)
Calculates power spectrum density for all frequencies between 8-50 bars
Identifies dominant cycle through peak detection in power spectrum
Signal Processing Pipeline
High-Pass Filter (HP): Removes long-term trends using a 5-bar polynomial smoother
hp := 0.5*(1+alpha1)*(price-nz(price[1])) + alpha1*nz(hp[1])
Low-Pass FIR Filter: Smoothes short-term noise with a 6-coefficient tapped delay line
cleaned_data := (hp + 2*nz(hp[1]) + 3*nz(hp[2]) + ... ) / 12
Dynamic RSI Calculation
Computes RSI values for all 43 possible cycle lengths simultaneously
Selects final output based on dominant cycle detected by DFT
Adjusts sensitivity through fractional multiplier (default 0.5)
KEY SIGNALS EXPLAINED
Fast Line: Derived from the most recent dominant cycle calculation, providing immediate trend indication
Slow Line: Uses exponentially weighted moving average to create lagged perspective
Candlestick Color Coding:
Yellow: Fast line above slow line indicates upward momentum
Fuchsia: Slow line above fast line signals downward movement
PROS AND CONS
✅ Advantages:
True-to-formula implementation maintains fidelity to Ehlers' original work
Real-time parameter adjustments allow tailoring to specific asset characteristics
Visual confirmation system aids in identifying valid trade setups
❌ Drawbacks:
Computational overhead due to constant recalculation of 43 cycle lengths
Label generation may experience slight latency during choppy markets
Requires intermediate Pine Script understanding for customization
TECHNICAL REFERENCES
This script directly references concepts from two key publications by John F. Ehlers:
Fourier Transforms for Traders (January 2007)
Introduces adaptive filtering techniques
Details DFT application for cycle identification
Cycle Analysis Techniques (April 2003)
Foundational work on market cycle theory
Discusses harmonic mean calculations
EXTENSION OPPORTUNITIES
Potential enhancements could include:
Backtesting Module: Allow users to test strategies against historical data
Multi-Symbol Comparison: Enable side-by-side analysis of related assets
Sentiment Overlay: Combine with volume profile data for comprehensive analysis
ACKNOWLEDGEMENTS
Special thanks to John F. Ehlers for pioneering the mathematical framework behind this indicator. The script strictly adheres to the formulas and variable naming conventions outlined in his publications, facilitating direct correlation with academic works.
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.
Penafian
Skrip sumber terbuka
Dalam semangat sebenar TradingView, pencipta skrip ini telah menjadikannya sumber terbuka supaya pedagang dapat menilai dan mengesahkan kefungsiannya. Terima kasih kepada penulis! Walaupun anda boleh menggunakannya secara percuma, ingat bahawa menerbitkan semula kod ini adalah tertakluk kepada Peraturan Dalaman kami.
Untuk akses pantas pada carta, tambah skrip ini kepada kegemaran anda — ketahui lebih lanjut di sini.