Advertisement
xmd79

Average True Range Oscillator

Jan 5th, 2023
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. // This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
  2. // © KaptanKirk - Süleyman Sülün - @TheSulun
  3.  
  4. //@version=5
  5. indicator(title="Average True Range Oscillator", shorttitle="ATRO", format=format.price, precision=2, timeframe="", timeframe_gaps=true, overlay = false)
  6.  
  7. ATR_per=input.int(14, "ATR Per")
  8. atr=ta.atr(ATR_per)
  9. Max_Min_per=input.int(20,"Period for ATR Max and Min") // Within how many bars (periods) should the ATR max and min values be determined?
  10. atrMax=ta.highest(atr,Max_Min_per) // Maximum ATR value in the specified period
  11. atrMin=ta.lowest(atr,Max_Min_per) // Minimum ATR value in the specified period
  12. ATR_Oscillator=100/((atrMax-atrMin)/(atr-atrMin)) // Calculation of the percentage of the difference between the Max and Min ATR values in the specified range of the instantaneous ATR value. So the process of converting this range to % oscillator.
  13. ATRO_SMA_Per=input.int(1, minval=1, title="SMA for ATR Oscillator") // The 'SMA Period' of the 'ATR Oscillator' can be increased to soften the 'ATR Oscillator' plot.
  14. plot(ta.sma(ATR_Oscillator,ATRO_SMA_Per), title="ATR Oscillator", color=color.navy, linewidth = 2, style=plot.style_line)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement