📅 财经日历 📊 实时波动 📈 大盘云图 📶 行情走势 🆚 投机情绪 🚀 今日热点

    均线报警30

    2019-08-29 · 2337 阅读
    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 LV3

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

    :lol不错

    虎豹 LV3

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

    帮你顶下哈!!

    粉红色的信笺 LV3

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

    学习了,不错

    趋势把握 LV3

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

    谢谢楼主分享

    xiaoyi13452 LV4

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

    谢谢

    lr兑换 LV5

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

    顶下
    您需要登录后才可以回帖 登录 | 注册

    提醒: 禁止引战、谩骂、灌水内容

    微信二维码

    有问题联系客服