OPEN-SOURCE SCRIPT
ATR Trailing Stop [Indicatr]

ATR Trailing Stop is a volatility-based trailing stop for long and short positions with a range filter that reduces whipsaw flips, plus a live readout of the stop distance in ATR and percent.
WHAT IT DOES
Fixed-percentage stops ignore volatility. ATR stops adapt to it, but in sideways markets they flip direction often. This script adds an ADX-based buffer that requires extra distance before flipping when the market is not trending.
HOW IT WORKS
HOW TO USE
THE CHART
ETHUSD daily with the chandelier stop (ATR 14 x 3, lookback 22). Green line = long stop, red line = short stop, triangles mark direction changes. The table in the top right shows the current stop distance.
WHAT IS ORIGINAL
Combines chandelier and midpoint ATR stops in one tool, adds an ADX-based flip buffer for range phases and a stop-distance readout. Position sizing is intentionally not included.
CREDITS
ATR and ADX (J. Welles Wilder), Chandelier Exit concept (Chuck LeBeau).
LIMITATIONS
Disclaimer
For educational and analytical purposes only. Not financial advice. Marks and signals are not buy or sell recommendations. Past behaviour does not guarantee future results.
WHAT IT DOES
Fixed-percentage stops ignore volatility. ATR stops adapt to it, but in sideways markets they flip direction often. This script adds an ADX-based buffer that requires extra distance before flipping when the market is not trending.
HOW IT WORKS
- Chandelier style: long stop = highest high (or close) of the lookback minus ATR x multiplier, short stop = lowest low plus ATR x multiplier.
- Midpoint style: hl2 plus/minus ATR x multiplier (Supertrend-like).
- Ratchet: the stop only moves in the direction of the trade.
- Flip: direction changes when price closes beyond the stop. With the range filter on and ADX below the threshold, price must close an additional distance (default 0.5 x ATR) beyond the stop.
- Table: direction, current stop distance (ATR and %), and whether the range filter is active.
HOW TO USE
- As a trailing exit for existing long or short positions, or as a volatility-based reference for initial stop placement.
- The stop distance readout helps compare risk across instruments.
- Alerts: turned long, turned short.
THE CHART
ETHUSD daily with the chandelier stop (ATR 14 x 3, lookback 22). Green line = long stop, red line = short stop, triangles mark direction changes. The table in the top right shows the current stop distance.
WHAT IS ORIGINAL
Combines chandelier and midpoint ATR stops in one tool, adds an ADX-based flip buffer for range phases and a stop-distance readout. Position sizing is intentionally not included.
CREDITS
ATR and ADX (J. Welles Wilder), Chandelier Exit concept (Chuck LeBeau).
LIMITATIONS
- Any trailing stop gives back part of a move before exiting.
- The range filter delays flips, which can mean a later exit when a real reversal starts.
- The stop can move on the current bar until it closes.
Disclaimer
For educational and analytical purposes only. Not financial advice. Marks and signals are not buy or sell recommendations. Past behaviour does not guarantee future results.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Indicatr - the indicators you know, rebuilt with market context: volume, trend and momentum, for long and short. Free open-source tools and Pro tools. Guides and setups: indicator.trading/en/link
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
Indicatr - the indicators you know, rebuilt with market context: volume, trend and momentum, for long and short. Free open-source tools and Pro tools. Guides and setups: indicator.trading/en/link
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.