ATR Trailing Stop Loss Indicator

I rely on this script for both my live trading and my backtesting process. I couldn’t live without it. It’s extremely simple – all it does is calculate your trailing stop price.

How It Works
The first number in blue is the current ATR (pips). The second number in green is your trailing stop loss price for Long trades, and the third number in red is your trailing stop loss price for Short trades.

For short trades, the stop loss price is calculated by adding the current ATR value to the highest-high of the given lookback period.

For long trades, the stop loss price is calculated by subtracting the current ATR value from the lowest-low of the given lookback period.

ATR Length:
ATR period (how many candles to include in the calculation).

Use Structure?
If set to true, the script will use swing lows and highs in its calculation. If set to false, the script will ignore swing lows and highs and give you the distance of the ATR from the current candle close instead.

How Far To Look Back For High/Lows:
Candle lookback period for swing high/lows.

ATR X ?:
This controls your ATR multiplier. For example, if you want to use a 2x ATR stop, set this to 2.

Chart Companion:
Here is the chart companion script for this indicator:

Source Code:
Go to https://zenandtheartoftrading.com/indicators/atr-trailing-stop-indicator/ for the source code – it’s free!
Remove from Favorite Scripts Add to Favorite Scripts
Follow @TradeWisdom on Twitter for Daily inspiration from the best trading wizards, psychologists and philosophers.

Go to http://www.zenandtheartoftrading.com for articles on forex trading, trading psychology, trading resources, Pine Script lessons and more!


Is this the same trailing stop that Wilder uses that involves the use of a sic?
+1 Reply
Good....in fact gr8 work.Thanks a lot.
+1 Reply
Great work. How do you determine where to Take profits or Stop loss?
+1 Reply
ZenAndTheArtOfTrading JordanBelfort93
@JordanBelfort93, That's entirely up to you man, there's no right or wrong way to do that. Well, technically there is haha - whatever you do, don't cut your profits so short that they don't make up for your losses (on average). It depends entirely on what timeframe you're trading and the volatility of the instrument, but a general rule of thumb is that anything over 1:1 is good. So if you're using a 1 ATR stop loss, try not to take your profit until price has exceeded 1 ATR profit (and ideally much more).

I personally try to shoot for 2 ATR worth of profit before I consider exiting my profitable trades. If you risk 1% per trade and you're making +2% on your average winner, then you only need to win about 35% of your trades to be profitable over the long-term (key word being "average winner" - not all your winners will be that big, but over a large sample size, the average ought to be well over 1% on your average winner unless your strategy has a 60%+ win rate).

This video might help you understand the math behind risk:reward and risk management: https://www.youtube.com/watch?v=PGkOH-oFOSI&%3Blist=PLSP_1DBafH-Eh33zVCtmy3FuqULNn5nt1&%3Bindex=4
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing Refer a friend House Rules Help Center Website & Broker Solutions Widgets Charting Solutions Lightweight Charting Library Blog & News Twitter
Profile Profile Settings Account and Billing Referred friends Coins My Support Tickets Help Center Ideas Published Followers Following Private Messages Chat Sign Out