TradingView
TradeAutomation
8 נוב׳ 2021 16:04

ATR Trailing Stop v5 

Bitcoin / US DollarBinance

תיאור

One of my favorite stops is the ATR Trailing Stop-loss. With the implementation of PineScript v5, a code update was needed in order to use this stop/exit-strategy with newer strategy scripts. A timeframe selector that was not featured on earlier versions is also included. This new version can be plugged into PineScript v5 strategies, and also has a simpler/cleaner code that makes the code logic easier to follow than prior versions.

For those that are unfamiliar with the ATR Trailing Stop exit strategy; it is a trailing stop that takes into account the volatility of the underlying asset by trailing the price series using a multiple of the Average True Range (ATR). In practice I’ve found that this exit can be more effective than traditional trailing stops, depending on the volatility of the asset you are trading. More detailed information can be found at stockopedia.com/learn/charts-technical-analysis/atr-trailing-stops-462698/

How do I use it? Add it to your chart as an indicator to visualize where the ATR stop would be with your settings. Or, copy and add it to your v5 strategy with the addition of a ta.crossunder(close, ATRTrailingStop) or ta.crossover(close, ATRTrailingStop) function. Special thanks and credit to HPotter who coded an earlier version of this in pine!
תגובות
Zentrader9
I'm trying to figure out how I would use this, I'm trying to calculate a stop that is 5% of the 14 period ATR. Is that possible with this indicator?
cacaprut
@Zentrader9, Yes you have only to set the ATR multiplier to 0.05 I think
joellaranjeira
thank you!!!
Claudita280272
How can i ad thi indicator to my chart
mariogaudreault
Great indicator, thank you. Would be great if we can change candle color.
DaytimeTinkerer
it seems very relevant to show it actually being used via strategy.exit ( ... stop = atrStop )
ZOoRoO81
Hello.

thank you for this indicator. Could you explain further more on how to incorporate it within the Low-High strat.

:) thank you!
TradeAutomation
@ZOoRoO81, You can add this to a strategy by embedding a ta.crossunder(close, ATRTrailingStop) or ta.crossover(close, ATRTrailingStop) function within one of your v5 script strategy.close() functions. The approach would be different depending on if you're long or short. You can combine and customize the code/strategies as you like. I also do custom coding as a service that you can book at TradeAutomation.net
עוד