Help needed for Exploration

amitrandive

Well-Known Member
#1
Dear All

Below is a Zig-Zag indicator.I need an exploration to write the values of HH,HL,LH and LL for any time frame.

Please note:The indicator looks to the future.

Code:
_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();

_SECTION_BEGIN("ZigZag");
P = Param("ZigZag_Percent",0.1,0.01,2,0.01);
ZigH  = Zig(H,P);		ZigL = Zig(L,P);
ZigHi = ZigH > Ref(ZigH,-1) AND ZigH > Ref(ZigH,1);		
ZigLo = ZigL < Ref(ZigL,-1) AND ZigL < Ref(ZigL,1);
j=0;	k=0;	PH[0] = PL[0] = 0;
for( i = 1; i < BarCount-1; i++ ) { 
 if (ZigLo[i])	{
	if (PL[k] > ZigL[i])  	PlotText("LL",i, L[i]-5, colorRed);
	else						PlotText("HL",i, L[i]-5, colorBlue);
	k = k + 1;		PL[k] = ZigL[i]; }
 if (ZigHi[i]) {
	if (PH[j] < ZigH[i])  	PlotText("HH", i, H[i]+5, colorBlue);
	else						PlotText("LH", i, H[i]+5, colorRed);
	j = j + 1;
	PH[j] = ZigH[i]; }
}
_SECTION_END();
 

Similar threads