Unfortunately i am getting junk values, furthermore, the OnBarUpdate() is getting called multiple times at the beginning of strategy . whereas it should be called only at 12:00, 12:15 and so on.
protected override void OnBarUpdate()
{
if(GetOHLC == true && BarsInProgress == 1)
{
Print("Low of some 15 min bar ="+ Lows[1][3]);
Print("High of some 15 min bar ="+ Highs[1][3]);
}
}
protected override void Initialize()
{
CalculateOnBarClose = true;
GetOHLC = true;
Add(PeriodType.Minute,15);
}
output Low of some 15 min bar =103.24 High of some 15 min bar =103.28 Low of some 15 min bar =103.15 High of some 15 min bar =103.27 Low of some 15 min bar =103.15 High of some 15 min bar =103.22 Low of some 15 min bar =103.16 High of some 15 min bar =103.22 Low of some 15 min bar =103.16 High of some 15 min bar =103.21 Low of some 15 min bar =103.07 High of some 15 min bar =103.22 etc etc
So,
a) why is OnBarUpdate() getting called at startup instead of at 1:15 pm or 1:30 pm?
b). why are the Highs[][] and Lows[][] returning junk values.
c) why are they printing different values. and why is checking for BarsInProgress == 0 returning the same output as BarsInProgress ==1
Shouldnt, Add(PeriodType.Minute,15); be my primary Bars object with index of 0.
why is it giving an output at all if i check for BarsInProgress ==1
Edit: I read somewhere that Initialise() for all the scripts gets called, when you run one script. Is that being the issue here? so i need to delete all my scripts before running a previous one?
I tried deleting all my previous scripts but that doesnt seem to make a difference

Comment