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

    Parabolic SAR Color - Alert响一次

    2019-08-23 · 5050 阅读
    //+------------------------------------------------------------------+
    //|                                                    SAR_COLOR.mq4 |
    //|                                                          Kalenzo |
    //|                                       http://www.foreksik.prv.pl |
    //+------------------------------------------------------------------+
    #property copyright "Kalenzo"
    #property link      "http://www.foreksik.prv.pl"

    #property indicator_color1 Yellow
    #property indicator_color2 Magenta
    #property indicator_chart_window
    #property indicator_buffers 2
    #property indicator_width1 1
    #property indicator_width2 1

    double sarUp[],sarDn[];//buffers
    extern bool AlertsEnabled=true;
    extern double Step = 0.01;//was .01
    extern double Maximum = 0.2;
    extern int Precision =4;
    double alertBar;

    //+------------------------------------------------------------------+
    //| Custom indicator initialization function                         |
    //+------------------------------------------------------------------+
    int init()
      {
    //---- indicators
       SetIndexStyle(0,DRAW_ARROW,STYLE_DOT);
       SetIndexStyle(1,DRAW_ARROW,STYLE_DOT);
       SetIndexBuffer(0,sarUp);
       SetIndexBuffer(1,sarDn);
       SetIndexArrow(0,115);
       SetIndexArrow(1,115);

       IndicatorShortName("SAR COLORED");
       SetIndexLabel(0,"SAR Up Channel");
       SetIndexLabel(1,"SAR Down Channel");

       SetIndexDrawBegin(0,2);
       SetIndexDrawBegin(1,2);
    //----
       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++)
       {
          double sar = NormalizeDouble(iSAR(Symbol(),0,Step,Maximum,i),Precision);
              if(sar >= iHigh(Symbol(),0,i))
          {
           if(AlertsEnabled==true && sarUp[i] == 0 && Bars>alertBar)
            {
            Alert("BB抛物线--下降--",Symbol(),"-",Period());
            alertBar = Bars;
           }
             sarUp[i] = sar;  
             sarDn[i] = 0;
          }
        else
          {
           if(AlertsEnabled==true && sarDn[i] == 0 && Bars>alertBar)
            {
            Alert("BB抛物线--上升--",Symbol(),"-",Period());
            alertBar = Bars;
            }
             sarUp[i] = 0;
             sarDn[i] = sar;
           }
       }
    //----
       return(0);
      }
    //+------------------------------------------------------------------+

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

    举报

     

    回答|共 17 个

    幸福猫猫 LV3

    发表于 2020-4-6 11:05:20 | 显示全部楼层

    前排支持下

    xiaomao155 LV3

    发表于 2020-6-4 16:47:02 | 显示全部楼层

    看帖回帖是美德!:lol

    奕金89 LV3

    发表于 2020-6-19 11:33:46 | 显示全部楼层

    谢谢楼主,共同发展

    富豪会所oh LV3

    发表于 2020-6-27 21:14:20 | 显示全部楼层

    我是来刷分的,嘿嘿

    medley LV9

    发表于 2020-7-5 15:14:55 | 显示全部楼层

    谢谢楼主分享

    rickyliao LV3

    发表于 2020-8-21 19:12:25 | 显示全部楼层

    帮你顶下哈!!

    相信自己 LV4

    发表于 2020-8-24 15:19:55 | 显示全部楼层

    学习了,不错

    你是否在笑 LV5

    发表于 2020-8-25 21:49:54 | 显示全部楼层

    谢谢楼主分享

    phnno LV6

    发表于 2020-9-3 16:20:48 | 显示全部楼层

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

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

    微信二维码

    有问题联系客服