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

    连续阴或阳报警(弹窗报警版)

    2019-08-24 · 3161 阅读
    /
    #property strict
    #property indicator_chart_window
    extern int 连续K线数=4;//连续k线数
    int mark=0,i;//报警标记
    //+------------------------------------------------------------------+
    //| Custom indicator initialization function                         |
    //+------------------------------------------------------------------+
    int OnInit()
      {
    //--- indicator buffers mapping

    //---
       return(INIT_SUCCEEDED);
      }
    //+------------------------------------------------------------------+
    //| Custom indicator iteration function                              |
    //+------------------------------------------------------------------+
    int OnCalculate(const int rates_total,
                    const int prev_calculated,
                    const datetime &time[],
                    const double &open[],
                    const double &high[],
                    const double &low[],
                    const double &close[],
                    const long &tick_volume[],
                    const long &volume[],
                    const int &spread[])
      {
    //---
    //mark=0;
       int 连续阴数=0,连续阳数=0;
       for(i=0;i<连续K线数;i++)
         {
          if(iOpen(NULL,0,i)-iClose(NULL,0,i)>0) 连续阴数++;
         }
       for(i=0;i<连续K线数;i++)
         {
          if(iOpen(NULL,0,i)-iClose(NULL,0,i)<0) 连续阳数++;
         }
       Comment("\n",连续K线数,"根K线范围内的阴线数:",连续阴数,"根 阳线数:",连续阳数,"根");

       if(连续K线数==连续阳数 && mark!=1)
         {
          //PlaySound("连续阳线.wav");
          Alert(Symbol(),"-",Period()" 连续出现",连续阳数,"根阳线");
          mark=1;
         }
       if(连续K线数==连续阴数 && mark!=2)
         {
         // PlaySound("连续阴线.wav");
          Alert(Symbol(),"-",Period()" 连续出现",连续阴数,"根阴线");
          mark=2;
         }

    //--- return value of prev_calculated for next call
       return(rates_total);
      }
    //+------------------------------------------------------------------+


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

    举报

     

    回答|共 13 个

    yujopozb LV4

    发表于 2020-1-5 14:16:12 | 显示全部楼层

    :lol不错

    yxstjqrg LV0

    发表于 2020-1-18 16:12:07 | 显示全部楼层

    过来看看的

    ghost LV3

    发表于 2020-4-26 14:41:14 | 显示全部楼层

    有竞争才有进步嘛

    ebsvfefuk LV3

    发表于 2020-6-14 22:41:45 | 显示全部楼层

    相当不错,感谢无私分享精神!

    kemax2012 LV3

    发表于 2020-7-3 10:42:11 | 显示全部楼层

    学习了,不错,讲的太有道理了

    ti操盘 LV3

    发表于 2020-7-9 13:11:52 | 显示全部楼层

    谢谢楼主分享

    人在深圳 LV4

    发表于 2020-7-22 22:33:02 | 显示全部楼层

    谢谢楼主分享

    arp LV3

    发表于 2020-8-9 22:58:53 | 显示全部楼层

    帮你顶下哈!!

    学汇生存 LV4

    发表于 2020-8-17 10:00:47 | 显示全部楼层

    学习了,不错
    12下一页
    您需要登录后才可以回帖 登录 | 注册

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

    微信二维码

    有问题联系客服