I want the ZigZag have the inputs the same as MT4.
Depth, Deviation and Backstep. (The same as MT4 ZigZag)
and
I have another kind of ZigZag that have SAR_step and SAR_maximum
This is a extract of the code of this last sar zigzag.
//---- input parameters
extern double SAR_step=0.02;
extern double SAR_maximum=0.2;
int start()
{
//int counted_bars=IndicatorCounted();
string txt;
int w,PosLow,PosHigh;
double LPic=1000000,HPic=0,price;
datetime TimeTmp;
//----
ExtMapBuffer1[0]=Close[0];
ExtMapBuffer2[0]=EMPTY_VALUE;
for( w=0;w<BarsCount;w++){
if( w!=0 ){ ExtMapBuffer1[w]=EMPTY_VALUE; ExtMapBuffer2[w]=EMPTY_VALUE; }
if( iSAR(NULL,0,SAR_step,SAR_maximum,w) > Close[w] && LPic>=Low[w] ){ LPic=Low[w]; PosLow=w; }
if( iSAR(NULL,0,SAR_step,SAR_maximum,w) < Close[w] && HPic<=High[w] ){ HPic=High[w]; PosHigh=w; }
// H -> L
if( iSAR(NULL,0,SAR_step,SAR_maximum,(w+1)) > Close[w+1] && iSAR(NULL,0,SAR_step,SAR_maximum,w) < Close[w] && HPic!=0)
{
ExtMapBuffer1[PosHigh]=HPic;
ExtMapBuffer2[PosHigh]=HPic;
HPic=0;
}
// L -> H
if( iSAR(NULL,0,SAR_step,SAR_maximum,w) < Close[w] && iSAR(NULL,0,SAR_step,SAR_maximum,w+1) > Close[w+1] && LPic!=1000000 )
{
ExtMapBuffer1[PosLow]=LPic;
ExtMapBuffer2[PosLow]=LPic;
LPic=1000000;
}
}
Thank you.
Comment