How to I code a DAILY ATR to use on intraday charts. I have tried thw following but it does not give me a single value for the day as I was expecting it would.
tr1 = ABS(DHigh(1) – DLow(1))
tr2 = ABS(DHigh(1) – DClose(2))
tr3 = ABS(DLow(1) – DClose(2))
TrueRange = wilderaverage[14](max(abs(Dhigh(i)-Dlow(i)),max(abs(Dhigh(i)-Dclose(i+1)),abs(Dlow(i)-Dclose(i+1)))))
Sorry posted the wrong second half of the formula.
tr1 = ABS(DHigh(1) – DLow(1))
tr2 = ABS(DHigh(1) – DClose(2))
tr3 = ABS(DLow(1) – DClose(2))
TrueRange = wilderaverage[14](Max(MAX(tr1,tr2),MAX(tr2,tr3)))
Check if you get the close that you think you do. Depending on which security you use this for the close might be in the middle of the night.
I already coded something around the Daily ATR calculation on an intraday timeframe, this is an example: https://www.prorealcode.com/prorealtime-indicators/daily-atr-range-for-intraday-chart/
Thanks Nicolas and Despair.
I am trying to put this into a Trading System, and cannot get it to work. The code returns a value for the current day, but I need a value for every day going back, and can’t see what to do.