TradingView
TheTrdFloor
28 เมษา 2022 เวลา 20 นาฬิกา 45 นาที

ATR Bands 

US Nas 100OANDA

คำอธิบาย

In many strategies, it's quite common to use a scaled ATR to help define a stop-loss, and it's not uncommon to use it for take-profit targets as well. While it's possible to use the built-in ATR indicator and manually calculate the offset value, we felt this wasn't particularly intuitive or efficient, and could lead to the potential for miscalculations. And while there are quite a few indicators that plot ATR bands in some form or another already on TV, we could not find one that actually performed the exact way that we wanted. They all had at least one of the following gaps:
  • * The ATR offset was not configurable (usually hard-coded to be based off the high or low, while we generally prefer to use close)
    * It would only print a single band (either the upper or lower), which would require the same indicator to be added twice
    * The ATR scaling factor was either not configurable or only stepped in whole numbers (often time fractional factors like 1.5 yield better results)


To that end, we took to making this enhanced version to meet all of the above requirements. While we were doing so, we decided to take this opportunity to also make some non-functional enhancements as well:
  • * Updated the indicator to the most recent version of Pine
    * Updated the indicator definition to allow alternate (non-chart) timeframe usage
    * Made the input types explicitly defined to improve consistency
    * Updated the inputs with appropriate minimum values and step sizes where appropriate
    * Separated settings into logical groups
    * Added helptext to the indicator settings noting usage and common settings values
    * Explicitly titled the on-chart plots of the ATR bands so that they can more easily be identified and referenced in other indicators/scripts, as well as the Data Window


Food for thought: When looking at some of the behaviors of these ATR bands, you can see that when price first levels out, you can draw a "consolidation zone" from the first peak of the upper ATR band to the first valley of the lower ATR band that price will generally respect. Look for price to break and close outside of that zone. When that happens, price will usually (but not always) make a notable move in that direction, which can be used as either a potential trigger or as an additional confluence with other indicators/price action.

Finally, while we have made what we feel are some noteworthy updates and enhancements to this indicator, and have every intention of continuing to do so as we find worthy opportunities for enhancement, credit is still due to the original author: AlexanderTeaH

เอกสารเผยแพร่

Some basic configuration defaults tweaks based on user feedback:
  • Updated default value for ATR Period (changed from 14 to 3)
  • Updated default values for ATR Upper and Lower Band Scaling Factor (changed from 2 to 2.5)
  • Updated helptext for ATR Scale Factor to reflect the updated defaults

เอกสารเผยแพร่

This update comprises of a few notable enhancements...
  • Added the ability to print a repositionable table on-chart giving exact values for the ATR bands in terms of both price and distance from close.
  • Added 2 additional (optional) bands to depict take-profit levels. The scaling factor for these bands is configurable and also used by the new table for take-profit calculations noted above.
  • Simplified the ATR Bands settings. While it originally seemed like a good idea to have the upper and lower bands independently configurable, we have yet to find any practical application where this would have been of any value.
  • Added default settings notes to indicator tool-tips.
ความคิดเห็น
ForexSpecialisten
can i add this to metatrader by any chance
TheTrdFloor
@AL3629, Unfortunately, MetaTrader has it's own coding language and it's very different from PineScript. We have no intentions of making a separate MetaTrader version of this (or any) of our indicators.
ClassicScott
The 'take profit' bands are identical to the regular ATR bands (which I would use as a stop) regardless of changing the ATR value. Something is wrong here. Also, price values don't update in the table when changing the 'take profit' ATR factor. Obviously there is an issue with a calculation somewhere. And your definition of repainting is wrong. Of course values on the current candle are going to change--the candle hasn't closed. Repainting is when past values change as a result of current price fluctuations. This makes it impossible to backtest without using bar replay because the past data is unreliable.
TheTrdFloor
@ClassicScott, I was unable to reproduce the behavior you mentioned about the take-profit bands and table not updating to reflect changes to the Take-Profit Scale Factor, or with the Take Profit bands not updating when that same setting is changed. If you wish to send us a message showing the problem and your settings for the indicator, we'd be glad to discuss and investigate deeper.

Regarding the "repainting" definition - if you have any suggestions for how to rephrase that setting or the accompanying tooltip to be more clear and accurate, we're certainly open to suggestions!
bradygv68
Great ATR!
Irukandji101
Hi - I have plotted the ATR on the Daily chart and visibility is set to Daily and all lower TFs but... the lines do no appear in my linked layouts/charts of the same ticker symbol on those lower TFs? Thanks.
russ95670
Hi great indicator, im trying to line these bands up with the super trend bands as to set an alert on the lower band. Super trend will not allpw alerts on the uper and lower lines, any idea how to line this up with super trend? Thanks.
rstuv
Great indicator, would it be possible to add DTR as well? please?
dinhlap1979
Tốt
เพิ่มเติม