|
楼主 |
发表于 2013-5-30 22:38
|
显示全部楼层
回复 2# jby0531
int i;
int limit;
int counted_bars=IndicatorCounted();
if(counted_bars<0) return(-1);
if(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
for (i=limit-1;i>=0;i--)
{
double mahigh=iMA(NULL,0,ma_period,0,MODE_SMA,PRICE_HIGH,i);
double mahighp=iMA(NULL,0,4,0,MODE_SMA,PRICE_HIGH,i+1);
double malow=iMA(NULL,0,ma_period,0,MODE_SMA,PRICE_LOW,i);
double malowp=iMA(NULL,0,4,0,MODE_SMA,PRICE_LOW,i+1);
double shang=iBands(NULL,0,Length,Deviation,0,PRICE_CLOSE,MODE_UPPER,i);
double shangp=iBands(NULL,0,Length,Deviation,0,PRICE_CLOSE,MODE_UPPER,i+1);
double xia=iBands(NULL,0,Length,Deviation,0,PRICE_CLOSE,MODE_LOWER,i);
double xiap=iBands(NULL,0,Length,Deviation,0,PRICE_CLOSE,MODE_LOWER,i+1);
if((mahighp>shangp)&&(mahigh<shang))
{
{
up=Low+50*MarketInfo(Symbol(),MODE_POINT);
if(i==0)
{
if(uptime!=Time)
{
Alert(Symbol()+Period()+"UP"+Bid);
uptime=Time;
}
}
}
}
if((malowp<xiap)&&(malow>xia))
{
{
down=High-50*MarketInfo(Symbol(),MODE_POINT);
if(i==0)
{
if(downtime!=Time)
{
Alert(Symbol()+Period()+"UP"+Bid);
downtime=Time;
}
}
}
}
}
会用MT4吗? 打开指标编辑器。参数设置5 20 2 |
|