请大侠帮手解决不报警的原因

 

#property indicator_separate_window
#property indicator_minimum -100
#property indicator_maximum 0
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
#property indicator_level1 -20
#property indicator_level2 -80
//---- input parameters输入参量
extern int WYPeriod=14;
//---- buffers缓冲
double WYBuffer[];
int Alertmark=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string sShortName;
//---- indicator buffer mapping
SetIndexBuffer(0,WYBuffer);
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
sShortName="WY("+WYPeriod+")";
IndicatorShortName(sShortName);
SetIndexLabel(0,sShortName);
//---- first values aren't drawn没有得出第一价值
SetIndexDrawBegin(0,WYPeriod);
//----
return(0);
}
//+------------------------------------------------------------------+ |
//+------------------------------------------------------------------+
int start()
{
int i,nLimit,nCountedBars;
if(Bars<=WYPeriod) return(0);

nCountedBars=IndicatorCounted();
i=Bars-WYPeriod-1;
if(nCountedBars>WYPeriod)
i=Bars-nCountedBars-1;
while(i>=0)
{
double dMaxHigh=High[Highest(NULL,0,MODE_HIGH,WYPeriod,i)];
double dMinLow=Low[Lowest(NULL,0,MODE_LOW,WYPeriod,i)];
WYBuffer[i]=-100*(dMaxHigh-Close[i])/(dMaxHigh-dMinLow);
i--;
}
if(Alertmark!=1 &&
WYBuffer[i]<-80)
{Alert(Symbol(),Period(),"小于报警"); Alertmark=1;}
//----
return(0);
}
//+------------------------------------------------------------------+

 
renwoxing 写道 >>

#property indicator_separate_window
#property indicator_minimum -100
#property indicator_maximum 0
#property indicator_buffers 1
#property indicator_color1 DodgerBlue
#property indicator_level1 -20
#property indicator_level2 -80
//---- input parameters输入参量
extern int WYPeriod=14;
//---- buffers缓冲
double WYBuffer[];
int Alertmark=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
string sShortName;
//---- indicator buffer mapping
SetIndexBuffer(0,WYBuffer);
//---- indicator line
SetIndexStyle(0,DRAW_LINE);
sShortName="WY("+WYPeriod+")";
IndicatorShortName(sShortName);
SetIndexLabel(0,sShortName);
//---- first values aren't drawn没有得出第一价值
SetIndexDrawBegin(0,WYPeriod);
//----
return(0);
}
//+------------------------------------------------------------------+ |
//+------------------------------------------------------------------+
int start()
{
int i,nLimit,nCountedBars;
if(Bars<=WYPeriod) return(0);

nCountedBars=IndicatorCounted();
i=Bars-WYPeriod-1;
if(nCountedBars>WYPeriod)
i=Bars-nCountedBars-1;
while(i>=0)
{
double dMaxHigh=High[Highest(NULL,0,MODE_HIGH,WYPeriod,i)];
double dMinLow=Low[Lowest(NULL,0,MODE_LOW,WYPeriod,i)];
WYBuffer[i]=-100*(dMaxHigh-Close[i])/(dMaxHigh-dMinLow);
i--;
}
if(Alertmark!=1 &&
WYBuffer[i]<-80)
{Alert(Symbol(),Period(),"小于报警"); Alertmark=1;}
//----
return(0);
}
//+------------------------------------------------------------------+

这样改就可以报警了WYBuffer[0]<-30)

外汇EA道道论坛,一个专业性的以MT4平台 的EA开发与技术交流为宗旨的中文互动平台

注册就送积分100,可以兑换EA课时,免费听EA讲座,也可兑换EA系统

注册先 送积分100 ,积分达到一定数量,可以兑换本论坛提供的优秀 EA交易系统 ,也可以 兑换EA课时 , 免费听EA讲座新开的专业性的外汇EA技术交流互动平台,放了许多宝宝,莫要错失机会 ,注册先送大礼100积分,可兑换EA课堂的课时,用于听EA讲座 外汇EA道道论坛 http://waihuiea.5d6d.com

外汇EA指标系统交流群QQ:73686416

原因: