9评论

0收藏

均线报警30

avatar zzhhanngg12345 | 1275 人阅读 | 9 人评论 | 2019-08-29

extern bool makeItPlay = true;
extern int maMethod = 0;
extern int maPeriod = 30;
extern int maShift = 0;
extern int appiledPrice = 0;
int PrevAlertTime = 0;
#property indicator_chart_window
#property indicator_color1 Yellow
#property indicator_buffers 1
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);
  }
//+------------------------------------------------------------------+


""
还没有人打赏,支持一下

评论|共 9 个

bbz09msj

发表于 2020-6-7 13:17:28 | 显示全部楼层

:lol不错

虎豹

发表于 2020-8-4 14:33:05 | 显示全部楼层

帮你顶下哈!!

用户名不得小于

发表于 2020-8-4 23:03:16 | 显示全部楼层

666666666666

粉红色的信笺

发表于 2020-8-14 22:48:35 | 显示全部楼层

学习了,不错

趋势把握

发表于 2020-9-1 10:31:42 | 显示全部楼层

谢谢楼主分享

xiaoyi13452

发表于 2021-7-5 10:00:24 | 显示全部楼层

谢谢

吹弹欲破

发表于 2021-7-23 13:50:56 | 显示全部楼层

lr兑换

发表于 2021-8-6 17:20:41 | 显示全部楼层

顶下

于于于

发表于 2024-4-18 17:41:32 | 显示全部楼层

您需要登录后才可以回帖 登录 | 注册 微信登录

EA之家评论守则