|
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
#property indicator_chart_window
#property indicator_buffers 3
#property indicator_color1 Green
#property indicator_color2 Orange
#property indicator_color3 White
//---- 自定义参量
//---- 自定义缓冲
double rhs[];
double rhx[];
double rhqd[];
double rh1,rh2,rh3,rh4;
int t1,t2,t3,t4;
int init()
{
IndicatorBuffers(3);
//---- 画出设定
SetIndexShift(0,0);
SetIndexStyle(0,3,0,0,Green);
SetIndexArrow(0,241);
SetIndexBuffer(0,rhs);
SetIndexShift(1,0);
SetIndexStyle(1,3,0,0,Orange);
SetIndexArrow(1,242);
SetIndexBuffer(1,rhx);
SetIndexShift(2,0);
SetIndexStyle(2,3,0,3,White);
SetIndexBuffer(2,rhqd);
SetIndexDrawBegin(0,0);
SetIndexDrawBegin(1,0);
SetIndexDrawBegin(2,0);
return(0);
}
int start()
{
int count=0;
int limit=Bars;
for(int i=limit-count-3;i>=1;i--)
{
if(High[i+1]>=High[i]&&High[i+1]>=High[i+2])
{count=limit-i;
rhs[i+1]=High[i+1];
t1=t2;
t2=t3;
t3=t4;
t4=i+1;
rh1=rh2;
rh2=rh3;
rh3=rh4;
rh4=High[i+1];
}
else
rhs[i]=0;
if(Low[i+1]<=Low[i]&&Low[i+2]>=Low[i+1])
{count=limit-i;
rhx[i+1]=Low[i+1];
t1=t2;
t2=t3;
t3=t4;
t4=i+1;
rh1=rh2;
rh2=rh3;
rh3=rh4;
rh4=Low[i+1];
}
else
rhx[i]=0;
if(rh1<=rh2&&rh3>=rh1&&rh2>=rh3&&rh4>=rh2&&t1!=t2&&t2!=t3&&t3!=t4)
rhqd[t4]=rh4;
else if(rh1>=rh2&&rh3<=rh1&&rh2<=rh3&&rh4<=rh2&&t1!=t2&&t2!=t3&&t3!=t4)
rhqd[t4]=rh4;
else
rhqd[t4]=0;
}
return(0);
} |
|