Started to write the new strategy. Having trouble in next things.
Want to find index of the bar of the current ZigZag high & low.
Having next code:
protected override void Initialize()
{
CalculateOnBarClose = true;
}
/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
///
int highZindex = 0;
int lowZindex = 0;
protected override void OnBarUpdate()
{
if(CurrentBar < 20)
return;
ZigZag zz = ZigZag(DeviationType.Percent, 0.5, true);
highZindex = CurrentBar - zz.HighBar(0, 1, CurrentBar);
lowZindex = CurrentBar - zz.LowBar(0,1, CurrentBar);
Print("Current ZigZag High is" + highZindex + Time[lowZindex]);
Print("Current ZigZag Low is" + lowZindex + Time[highZindex]);
}
Error on calling 'OnBarUpdate' method for strategy *NAME OF THE STRATEGY* Bar index needs to be greater/equal 0
What do I need to do with this?
Thanks!

Comment