外汇EA
均线报警30
回复:0  浏览:768
  • 楼主admin 圈主
  • 2020-01-01 14:42
double maBuffer[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                  |
//+------------------------------------------------------------------+
int init()
 {
//---- indicators
   SetIndexStyle(0,DRAW_LINE,0,1);
   SetIndexBuffer(0,maBuffer);
//----
   return(0);
 }
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function               |
//+------------------------------------------------------------------+
int deinit()
 {
//----
//----
   return(0);
 }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                     |
//+------------------------------------------------------------------+
int start()
 {
//----
   int limit;
   int counted_bars=IndicatorCounted();
   if(counted_bars 0) counted_bars=0;
   if(counted_bars 0) counted_bars--;
   limit=Bars-counted_bars;
//----
   for(int i = 0 ;i limit ;i++)
   {
     maBuffer[i]=iMA(Symbol(),0,maPeriod,maShift,maMethod,appiledPrice,i);
   }
   double ppMA = NormalizeDouble(iMA(Symbol(),0,maPeriod,maShift,maMethod,appiledPrice,3),4);
   double pMA = NormalizeDouble(iMA(Symbol(),0,maPeriod,maShift,maMethod,appiledPrice,2),4);
   double cMA = NormalizeDouble(iMA(Symbol(),0,maPeriod,maShift,maMethod,appiledPrice,1),4);
   if (CurTime() - PrevalertTime Period()*60)
   {
     if(ppMA pMA pMA cMA)
     {
       alert( 下降
       PrevalertTime = CurTime();
     }
     else if(ppMA pMA pMA cMA)
     {
       alert( 上升
       PrevalertTime = CurTime();
     }
   }   
//----
   return(0);
 }
//+------------------------------------------------------------------+