zzhhanngg12345 发表于 2019-8-23 00:14:12

Parabolic SAR Color - Alert响一次

//+------------------------------------------------------------------+
//|                                                    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 == 0 && Bars>alertBar)
      {
      Alert("BB抛物线--下降--",Symbol(),"-",Period());
      alertBar = Bars;
       }
         sarUp = sar;
         sarDn = 0;
      }
    else
      {
       if(AlertsEnabled==true && sarDn == 0 && Bars>alertBar)
      {
      Alert("BB抛物线--上升--",Symbol(),"-",Period());
      alertBar = Bars;
      }
         sarUp = 0;
         sarDn = sar;
       }
   }
//----
   return(0);
}
//+------------------------------------------------------------------+

幸福猫猫 发表于 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

学习了,不错
页: [1] 2
查看完整版本: Parabolic SAR Color - Alert响一次