I need to find a way to not set the values im testing in my if statements to zero every time OnBarUpdate() is called. The orH, and orL variables are the ones im referring to specifically, the others work fine since the functions used to assign them returns the correct value on any bar.
Im thinking i will have to reference the bars that occurred during this time frame each time using some sort of indexing each time the OnBarUpdate() function is called.
protected override void OnBarUpdate() { double orH = 0, orL = 0, openRH, openRL, yH = 0, yL = 0; int index; if(ToTime(Time[0]) >= 160000 && ToTime(Time[0]) < 180000) { if(High[0] > orH) { orH = High[0]; openRH = orH; } if(Low[0] < orL) { orL = Low[0]; openRL = orL; } } if((PriorDayOHLC().PriorLow[0]) != 0) { yL = PriorDayOHLC().PriorLow[0]; yH = PriorDayOHLC().PriorHigh[0]; } ORhigh.Set(orH); ORlow.Set(orL); Yh.Set(yH); Yl.Set(yL); }
Comment