17评论

1收藏

Parabolic SAR Color - Alert响一次

avatar zzhhanngg12345 | 4274 人阅读 | 17 人评论 | 2019-08-23

//+------------------------------------------------------------------+
//|                                                    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 个

幸福猫猫

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

前排支持下

xiaomao155

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

看帖回帖是美德!:lol

奕金89

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

谢谢楼主,共同发展

富豪会所oh

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

我是来刷分的,嘿嘿

medley

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

谢谢楼主分享

rickyliao

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

帮你顶下哈!!

相信自己

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

学习了,不错

你是否在笑

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

谢谢楼主分享

phnno

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

学习了,不错

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

EA之家评论守则