OPEN-SOURCE SCRIPT

LRHA Trend Shift Detector

406
LRHA Trend Shift Detector (TSD)
The LRHA Trend Shift Detector is an advanced momentum exhaustion indicator that identifies potential trend reversals and changes by analyzing Linear Regression Heikin Ashi (LRHA) candle patterns. TSD focuses on detecting when strong directional moves begin to lose momentum.

🔬 Methodology
The indicator employs a three-stage detection process:

  1. LRHA Calculation: Applies linear regression smoothing to Heikin Ashi candles, creating ultra-smooth trend-following candles that filter out market noise
  2. Extended Move Detection: Identifies sustained directional moves by counting consecutive bullish or bearish LRHA candles
  3. Momentum Exhaustion Analysis: Monitors for significant changes in candle size compared to recent averages


When an extended move shows clear signs of momentum exhaustion, the indicator signals a potential trend shift with red dots plotted above or below your candlesticks.

⚙️ Parameters
Core Settings
  • LRHA Length (11): Linear regression period for smoothing calculations. Lower values = more responsive, higher values = smoother trends.
  • Minimum Trend Bars (4): Consecutive candles required to establish an "extended move." Higher number detects longer term trend changes.
  • Exhaustion Bars (3): Number of consecutively smaller candles needed to signal exhaustion. Lower is more sensitive.
  • Size Reduction Threshold (40%): Percentage decrease in candle size to qualify as "exhaustion." Lower is more sensitive.


Trend Trading
  • Pullback Entries: Identify exhaustion in counter-trend moves for trend continuation
  • Exit Strategy: Recognize when main trend momentum is fading
  • Position Sizing: Reduce size when seeing exhaustion in your direction


🎛️ Optimization Tips
For More Signals (Aggressive)
- Decrease LRHA Length (7-9)
- Reduce Minimum Trend Bars (2-3)
- Lower Size Reduction Threshold (25-35%)

For Higher Quality (Conservative)
- Increase LRHA Length (13-18)
- Raise Minimum Trend Bars (5-6)
- Higher Size Reduction Threshold (45-55%)

⚠️ Important Notes⚠️

- **Not a Complete Strategy**: Use as confluence with other analysis methods
- **Market Context Matters**: Consider overall trend direction and key support/resistance levels
- **Risk Management Essential**: Always use proper position sizing and stop losses
- **Backtest First**: Optimize parameters for your specific trading style and instruments

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.