The easiest and fastest zigzag.
Author: Yury Kulikov
The first line in your onCalculate is
for(int i=calculated>0?calculated-1:0; i<total-1; i++)
On my backtest, calculated starts at 262. Total is also 262. This means that the indicator does not descend into the for loop as 261 !< 261.
But the indicator still paints zigzag red lines on the backtester. How is this the case?