INVITE-ONLY SCRIPT

Dynamic Swing Retracement Tracker

41
This indicator automatically identifies potential reversal zones within trending markets by combining momentum-based directional filters with geometric price swing analysis.
Methodology:

Directional Bias Filter: Utilizes two exponential moving averages (configurable periods, default 50 and 200) as a momentum comparison mechanism. When the faster average exceeds the slower average, bullish bias is established; the inverse confirms bearish bias.
Automated Swing Recognition: The script continuously scans for local price extremes using pivot analysis with a user-defined lookback window (default 36 bars). These extremes become anchor points for calculating potential retracement zones.

Geometric Retracement Zones: Between each pair of swing extremes, the script calculates key mathematical ratios (0.5 and 0.618) to identify zones where price is statistically likely to find support or resistance during pullbacks. These zones are used for signal generation but remain invisible on the chart.
Signal Generation Logic:

Long entry signals appear when price retraces into calculated zones during bullish bias conditions
Short entry signals appear when price retraces into zones during bearish bias conditions
All signals require full candle confirmation to eliminate intra-bar noise
A customizable cooldown mechanism prevents signal clustering

Automated Risk Visualization:
Invalidation level (traditionally called "stop loss") placed beyond the most recent swing extreme, with adjustable pip buffer for spread accommodation

Three progressive target zones calculated using geometric extensions (1.618x, 2.0x, and 2.618x multiples of the original swing range)
All price levels displayed as horizontal reference lines spanning 20 bars (10 before, 10 after the signal candle

Technical Implementation:

Swing detection uses TradingView's built-in pivot functions with symmetric lookback
Retracement calculations based on classical golden ratio mathematics
Label positioning dynamically adjusts using Average True Range to maintain visibility across different volatility conditions
All drawing objects are refreshed on each bar to comply with platform object limits

Practical Application:
This tool is designed for traders who want to systematically identify counter-trend entries within established trends. Rather than manually drawing retracement levels, the indicator automates the process and provides immediate visual feedback on potential entry zones with pre-calculated risk and reward parameters.
Customization Options:

Momentum filter periods (default 50/200)
Swing detection sensitivity
Signal spacing controls
Risk buffer adjustment
Individual component visibility toggles

Important Notes:
This indicator does not predict future price movements. It identifies historical swing patterns and mathematically-derived levels based on past price action. All trading decisions should be made in conjunction with proper risk management and market analysis.

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.