ZigZag indicator to work in Optimization

 

Hi

When the ZigZag indicator was "fixed" from v600, it effectively made it difficult to use this indicator in an EA with strategy Tester and optimization, unless you isolate Backstep and don't include this in the optimization.

I use Zigzag in my Ea using icustom to call it. And therefore when backtesting would like to be able to pass the Depth / Deviation and Backstep as optimized parameters - usually starting at 2, stepping by 2 and stopping at 12.

As there is now code which prevents the Backstep from being greater than or equal to Depth the indicator doesn't work.I have tried remving this code, but that didn't work either.

is it possible to modify this indicator so that it would work in Optimization?

I tried

if (InpBackstep>=0)
        {
        InpDepth=InpBackstep+1;
        }

but that won't work as they are parameters that I can't pass values to.

Any suggestions on how to achieve this? I assume the indicator needs modification rather than the EA code....

Reason: