In the OnBarUpdate() function, given that i am using 2 minute bars for my strategy, i would like to do something like:
//Get the total volume of the previous 10 bars:
double volumeOfPrevoius10Bars = VOL()[0] + VOL()[1] + VOL()[2] + VOL()[3] + VOL()[4] + VOL()[5] + VOL()[6] + VOL()[7] + VOL()[8] + VOL()[9];
//Get the total volume of 10 bars during the same time of the previous day, which is 195 bars ago using a 2 minute char, so I do something like:
double volumeOfPrevoius10BarsYesterday = VOL()[195] + VOL()[196] + VOL()[197] + VOL()[198] + VOL()[199] + VOL()[200] + VOL()[201] + VOL()[202] + VOL()[203] + VOL()[204];
But this doesn't work as I run the strategy because the VOL() function only can handle [0] as the index, every other one gets an index out of bound exception.
How do I acheive this in the OnBarUpdateFunction?
Thanks!

Comment