查看完整版本: kd提醒器,求助

lookbbs 2008-5-23 16:51

kd提醒器,求助

目前的是盘中提醒,想要收盘后提醒,该如何修改呢
//+------------------------------------------------------------------+
//|                                                     RSIAlert.mq4 |
//|                       Copyright ?2005, MetaQuotes Software Corp. |
//|                                        [url]http://www.metaquotes.net[/url] |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2005, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property indicator_chart_window
//---- input p***meters
extern int       Stochasticperiod=9;
extern int       UPLevel=90;
extern int       DNLevel=10;
extern int       Alert_Delay_In_Seconds=300;
int PrevAlertTime=0;
//---- buffers
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init()
  {
//---- indicators
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start()
  {
  //---- TODO: add your code here
  int limit, i;
  double Stochasticnow, Stochasticprevious;
  int  counted_bars=IndicatorCounted();
//---- check for possible errors
   if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
//----
   for (i = 0; i <= limit; i++)
  { Stochasticnow=iStochastic(NULL,0,Stochasticperiod,3,3,MODE_SMA,0,MODE_MAIN,i);
   Stochasticprevious=iStochastic(NULL,0,Stochasticperiod,3,3,MODE_SMA,0,MODE_MAIN,i+1);
   
   if ((i==0)&& (Stochasticnow>=UPLevel) && ((CurTime() - PrevAlertTime)> Alert_Delay_In_Seconds))
    {
    Alert(Symbol()," ",Period()," Stochastic  up to ",UPLevel,"; at ",Close[i]);
    PrevAlertTime = CurTime();
    }
   else if ((i==0)&&(Stochasticnow<=DNLevel) && ((CurTime() - PrevAlertTime) > Alert_Delay_In_Seconds))
    {
    Alert(Symbol()," ",Period()," Stochastic  down to ",DNLevel,"; at ",Close[i]);
    PrevAlertTime = CurTime();
    }
  }
//----
   return(0);
  }
//+------------------------------------------------------------------+

startexcel 2008-5-23 17:32

你现在计算时就把没收盘的也算了,如果你要收盘在提醒,就不要计算未收盘的。也就是不要算i=0的

xfxyldj 2008-5-23 17:40

直接将i==0改成i==1即可

lookbbs 2008-5-23 19:35

改了,但不提醒阿,继续求助~~~

xfxyldj 2008-5-24 07:03

可能你改错地方了。
如果原来能报警,修改后也一定能报警的。

修改IF判断中的i==0未i==1应该可以的(两处)。

ahuang62 2008-5-25 01:57

好好学习,天天进步,谢谢!

lookbbs 2008-5-26 12:17

是按照这个修改的,但不提醒,是否要把原来的提醒器指标删除,两个是否有冲突,难啊~~
页: [1]
查看完整版本: kd提醒器,求助