OPEN-SOURCE SCRIPT
ATR Trailing Stop

ATR Trailing Stop (Dynamic Volatility Regimes)
==============================================
This indicator implements an adaptive ATR-based trailing stop for long positions. The stop automatically adjusts based on stock volatility, tightening during fast movements and widening during calm periods. It is designed as a trade management tool to help protect profits while staying aligned with strong trends.
How It Works
------------
* Tracks the highest high over a configurable lookback window and ensures this “top” never moves downward.
* Computes the trailing stop as:**Top – ATR × Dynamic Multiplier**
* The ATR multiplier changes depending on volatility:
* Low volatility → Wide stop (slower trailing)
* Medium volatility → Standard trailing
* High volatility → Tight stop (faster trailing)
* The trailing stop only moves upward; it never decreases.
* If price falls significantly below the stop (default: 5%), the system resets and begins trailing from a new top.
* An optional price-scale label displays:
* Current stop value
* Volatility regime (LOW / MID / HIGH)
* ATR percentage and active multiplier
Alerts
------
Two alert conditions are included:
### Trailing Stop – Near
Triggers when price moves within a user-defined percentage above the stop.
### Trailing Stop – Hit
Triggers when price touches or closes below the stop.
How to Use
----------
1. Add the indicator to any chart (daily timeframe recommended).
2. Configure:
* ATR length
* Lookback bars
* Volatility thresholds
* ATR multipliers
3. Set alerts for early warnings or stop-hit events.
4. Use the stop line as a dynamic risk-management tool to guide exit decisions and protect profits.
Notes
-----
* Designed for long-only trailing logic.
* This indicator does not generate entry signals; it is intended for stop management.
==============================================
This indicator implements an adaptive ATR-based trailing stop for long positions. The stop automatically adjusts based on stock volatility, tightening during fast movements and widening during calm periods. It is designed as a trade management tool to help protect profits while staying aligned with strong trends.
How It Works
------------
* Tracks the highest high over a configurable lookback window and ensures this “top” never moves downward.
* Computes the trailing stop as:**Top – ATR × Dynamic Multiplier**
* The ATR multiplier changes depending on volatility:
* Low volatility → Wide stop (slower trailing)
* Medium volatility → Standard trailing
* High volatility → Tight stop (faster trailing)
* The trailing stop only moves upward; it never decreases.
* If price falls significantly below the stop (default: 5%), the system resets and begins trailing from a new top.
* An optional price-scale label displays:
* Current stop value
* Volatility regime (LOW / MID / HIGH)
* ATR percentage and active multiplier
Alerts
------
Two alert conditions are included:
### Trailing Stop – Near
Triggers when price moves within a user-defined percentage above the stop.
### Trailing Stop – Hit
Triggers when price touches or closes below the stop.
How to Use
----------
1. Add the indicator to any chart (daily timeframe recommended).
2. Configure:
* ATR length
* Lookback bars
* Volatility thresholds
* ATR multipliers
3. Set alerts for early warnings or stop-hit events.
4. Use the stop line as a dynamic risk-management tool to guide exit decisions and protect profits.
Notes
-----
* Designed for long-only trailing logic.
* This indicator does not generate entry signals; it is intended for stop management.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.