I think that it’s normal to get the same behavior with a loop through Lows and Highs than using other internal instructions. If the candlesticks don’t exist, the loop doesn’t pass on them and conditions are not checked.
You can verify this assumption by storing the barindex in a variable between lines 6 and 7 for instance and compare it with the one found on your chart, you’ll then be able to verify if the empty candles are counted in the loop or not.
If a data is calculated on time series, time should be the determinal of period of consideration for the calculation, eg. arithmetic means of 5 number of series of 0, 1, 3, 1, 3, 3 is 8/5 and of 6 numbers is 11/6. Skipping the undefined value of 0 as suggested is an error.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok