--- In [email protected], "murthysuresh" <mo...@...> wrote:
>
> i am trying to plot the peaks and troughs.
> i could use some help with the zigzag as i am confused with the paramter %
> change which is defined as a number. any ideas is appreciated.
>
ok. i had so much trouble with itthat i started coding without zigzag.
here is my starter code. any ideas and help appreciated.
i just plotted the peaks and troughs.
_SECTION_BEGIN("CCI_Divergence");
//WARNING: CODE LOOKS 1 DAY INTO FUTURE.
array=CCI();
Color=colorBlue;
//Plot( array, "", colorDefault, styleLine | styleThick | styleNoLabel);
//Plot( array, "", Color, styleHistogram );
_SECTION_END();
Change=MA(abs(100*(array-Ref(array,-1))/array),14);
adjz = Param("Zig",10,0,15.0,.1);
adjc = Param("Back",0,0,BarCount,1);
CAdj = Ref(array,-adjc);
Graph1 = CAdj;
Zigzag = Zig( array, LastValue(Change));
Plot( Zigzag, "Zigzag", colorGreen, styleNoTitle | styleLine );
//Peakshape=IIf(Peak(array, LastValue(Change),1),shapeStar,shapeNone);
//Peakvalue=Peak(array, LastValue(Change),1);
//PlotShapes(Peakshape,colorRed);
firstVisibleBar=Status("firstvisiblebar");
lastVisibleBar=Status("lastvisiblebar");
CCITurningdown=array>Ref(array,-1) AND array >Ref(array,1);
CCITurningup=array<Ref(array,-1) AND array<Ref(array,1);
CCIpeak= IIf(array>0 AND CCITurningdown,shapeStar,shapeNone);
CCItrough= IIf(array<0 AND CCITurningup,shapeSquare,shapeNone);
PlotShapes(CCIpeak,colorRed);
PlotShapes(CCItrough,colorRed);
Look4Shorts=EMA(C,9)<EMA(C,20);
Look4Longs=EMA(C,9)>EMA(C,20);
PlotShapes(IIf(ValueWhen(CCItrough,C,1)>C AND
ValueWhen(CCItrough,CCItrough,1)<array,shapeCircle,shapeNone),colorOrange);
/*
CCI Divergence Occurs when the c < valuewhen(ccirough) and cci >last ccitrough.
*/
for ( b = firstVisibleBar;((b < lastVisibleBar) AND (b<BarCount)) ;b++ )
{
//_TRACE("valie of peak" + NumToStr(Peakvalue[b]));
}