ka66

ka66: ATR Stop Channel

ka66 Atualizado   
ATR Stop Channel: Often used as a dynamic stop loss management tool, this indicator:

  • Calculates the ATR over a configurable period, default 14
  • Based on configurable multipliers, draws a channel of (close + atr-multiple, close - atr-multiple)

The reference point of close is also configurable to allow a different source, e.g. you can use an EMA if you wanted to make a Keltner channel.

The upper channel line can be used for short position stop management, while the bottom one is for long positions. Multipliers can also be configured separately for long vs. short, given that one common market anomaly is that short positions can often have more aggressive stops.

ATR is calculated as the Simple Moving Average of TRs, no fancy weighted averaging. The tradingview atr function uses RMA, an EMA variant used in RSI, I prefer simpler averaging. The lag can be a feature if used well. Additionally, it's easier to reason about.

Note: For a more dedicated and full-featured multi-ATR|Keltner channels however, see my: "ka66: Multi ATR Channels", which is likely better suited for price analysis and channel trading.
Notas de Lançamento:
Enhancements

  • Much more consistent use of the chosen centre source line. Previously, there were too many adjustments around high and low when drawing bands, a logical bug really. This is the most important change.
  • Updated to Pine v5
  • Allow different timeframe selection.
  • Allow several different averaging types for the ATR, defaulting to the original Wilder RMA.
  • Display current ATR Price Distance from centre source line in a table.
  • Option to display values in points, but requires the correct divisor to show pips, for example.
  • Add more usage guidance in source code, namely: besides use as a stop channel, also as a no-trade zone with adjustable low-volatility multipliers. And thus, use as a potential breakout identification points, when price goes beyond the low-volatility zone.
Notas de Lançamento:
This is a further refinement of the ATR bands, to now allow for trailing stops, and a more explicit choice of centre line using configurable common moving averages.

The key thing to note is that ATR shifts from long to short and vice versa when price closes above or below the stop line, not when it just goes high or low (so you'll see high/low wicks penetrating the the trailing stop band, and the band remains there).

Thus, in a particularly volatile market, you need to adjust the multiplier if you are using it to trail stops. However, note that if your entry is decent, the idea is to get into a smooth trend to actually trail, something with reasonably low (but directional) volatility on the trailing timeframe.

If you enable the Debugging checkbox, you'll see the original bands and how the trailing stop band works. You can show/hide it from the UI settings as needed.

There are a few of these trailing stop indicators on TradingView, mine's not special in terms of function, but I needed to understand the logic if I want to use it to manage risk, and decided to write it myself, with code that is rather more verbose, but clearer, in my view, in its intent.

A recent tweet by Linda Raschke (of Market Wizard fame, and all-round awesome person), showed using trailing stops with a very short ATR period (2 to 3), tracking a price mean, with some deviation/multiple from that mean, capturing a sizeable chunk of the swing when trailed. This is the inspiration behind these latest changes.
Script de código aberto

Dentro do verdadeiro espírito TradingView, o autor deste script publicou ele como um script de código aberto, para que os traders possam compreender e checar ele. Um viva ao autor! Você pode usá-lo gratuitamente, mas a reutilização deste código em uma publicação é regida pelas Regras da Casa. Você pode favoritá-lo para usá-lo em um gráfico.

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.

Quer usar esse script no gráfico?