Zig on chart different to exploration

Hello, I have used the code below to populate an exploration. Also applied zig indicator to chart. Issue is that the turning points in the exploration dont match those on the chart. I dont understand why given same zig parameters for both.

Any comments appreciated.


Chart is SPX and red arrow is 12 Sept 2022. There is no 5% zig shown.

Exploration shows multiple down turn dates in a row? but up and down turrns should alternate, right?
image

SetOption("warninglevel",1);
// Find the Zig turning points

condup = IIf(Cross(Zig(H,5),Ref(Zig(H,5),-1)),H,Null);
conddn = IIf(Cross(Ref(Zig(l,5),-1),Zig(l,5)),l,Null);


Filter=condup OR conddn;

AddColumn(condup,"condup");
AddColumn(conddn,"conddn");


_SECTION_BEGIN("Price");
SetChartOptions(0,chartShowArrows|chartShowDates);
//_N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | ParamStyle("Style") | GetPriceStyle() ); 
_SECTION_END();

Plot(Zig(H,5),"Zig",colorblue);


@stevecar144, you are plotting only the Zig for High.

Try adding:

Plot( Zig( L, 5 ), "Zig Low", colorOrange );
2 Likes

Thanks for the reply.

I need to rethink this problem and the coding.

Consider the thread closed. Cheers

This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.