I believe my problem lies when int zigzag returns a value of -1. I'm stuck on work arounds on how to prevent an index value of -1, to avoid a crash.
int zigzag = (Math.Min(ZigZag(DeviationType.Points,VARIABLE1,fa lse).HighBar(0, 1, 1000), ZigZag(DeviationType.Points,VARIABLE1,false).LowBa r(0, 1, 1000)));
Value.Set(Range1(zigzag)[0]);
Comment