OPEN-SOURCE SCRIPT

ATR Trailing Stop [Indicatr]

444
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
  1. Chandelier style: long stop = highest high (or close) of the lookback minus ATR x multiplier, short stop = lowest low plus ATR x multiplier.
  2. Midpoint style: hl2 plus/minus ATR x multiplier (Supertrend-like).
  3. Ratchet: the stop only moves in the direction of the trade.
  4. 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.
  5. 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.

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。