Hello,
in a intraday setting, what’s the best and most effective code to sum the lows and highs of every bar starting from the 10am bar and resetting each day at intradaybarindex=0? Code has to work across all intraday timeframes ie starts summing from 10am bar onwards (including the 10am bar itself)
If IntraDayBarIndex = 0 then
HIs = 0
LOs = 0
Endif
If OpenTime >= 100000 then
HIs = HIs + high
LOs = LOs + low
Endif
HIs and LOs will retain the sums you need.
It hasn’t worked accurately. Something needs to be fixed.
Incidentally if I run the below test code:
b= opentime = 100000
return b
It returns 1 at every opentime = 100000 including today, yesterday and every history day in chart.
I need it to return 1 on ONLY the 10am bar of the current trading day.
It is working thank you. I was not counting the current bar 🙂