10评论

0收藏

ADX-箭头 -报警 请高手给改编一下 让它执行

avatar 哈哈_eT901 | 3312 人阅读 | 10 人评论 | 2017-02-02

//+------------------------------------------------------------------+
//|                                                       ADX-报警.mq4 |
//|                        Copyright 2014, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2014, MetaQuotes Software Corp."

#property version   "1.00"
#property strict
#property indicator_separate_window
#property indicator_minimum 0
#property indicator_maximum 100
#property indicator_buffers 4
#property indicator_plots   4
//--- plot DI1
#property indicator_label1  "DI1"
#property indicator_type1   DRAW_LINE
#property indicator_color1  clrRed
#property indicator_style1  STYLE_SOLID
#property indicator_width1  1
//--- plot DI2
#property indicator_label2  "DI2"
#property indicator_type2   DRAW_LINE
#property indicator_color2  clrGreen
#property indicator_style2  STYLE_SOLID
#property indicator_width2  1
//--- plot up
#property indicator_label3  "up"
#property indicator_type3   DRAW_LINE
#property indicator_color3  clrRed
#property indicator_style3  STYLE_SOLID
#property indicator_width3  1
//--- plot down
#property indicator_label4  "down"
#property indicator_type4   DRAW_LINE
#property indicator_color4  clrRed
#property indicator_style4  STYLE_SOLID
#property indicator_width4  1
//--- input parameters
input int      preit=14;
//--- indicator buffers
double         DI1Buffer[];
double         DI2Buffer[];
double         DI1pBuffer[];
double         DI2pBuffer[];
double  DI1,DI2,DI11,DI22;
double         upBuffer[];
double         downBuffer[];
datetime jincha=0;
datetime sicha=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,DI1Buffer);
   SetIndexBuffer(1,DI2Buffer);
   SetIndexBuffer(2,upBuffer);
   SetIndexBuffer(3,downBuffer);

//---
   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[])
  {
//---
  int limit;
int counted_bars=IndicatorCounted();
//---- check for possible errors
if(counted_bars<0) return(-1);
//---- last counted bar will be recounted
if(counted_bars>0) counted_bars--;
limit=1000-counted_bars;
//---- macd counted in the 1-st buffer
for(int i=limit; i>=0; i--)
   {

     double DI1=iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,i);
     double DI2=iADX(NULL,0,14,PRICE_CLOSE,MODE_PLUSDI,i-1);
     double DI11=iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,i);
     double DI22=iADX(NULL,0,14,PRICE_CLOSE,MODE_MINUSDI,i-1);
     if((DI1>DI1)&&(DI11<DI22))//金叉
          {
             if(i==0)
               {
                 if(jincha!=Time[0])
                   {
                     Alert("金叉");
                     jincha=Time[0];
                   }
               }
               upBuffer[i]=Low[i]-100*Point;
          }
     if((DI1<DI1)&&(DI11>DI22))//死叉
          {
             if(i==0)
               {
                 if(jincha!=Time[0])
                   {
                     Alert("死叉");
                     jincha=Time[0];
                   }
               }
          }     downBuffer[i]=Low[i]-100*Point;     
   }

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


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

评论|共 10 个

小色猫

发表于 2020-1-28 18:32:28 | 显示全部楼层

小手一抖,积分到手!

一盏孤灯

发表于 2020-6-10 13:31:12 | 显示全部楼层

路过,支持一下啦

樱子

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

前排支持下分享

Markets

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

路过,支持一下啦

统一奶茶

发表于 2020-7-30 13:21:43 | 显示全部楼层

学习了,不错

顺其自然。

发表于 2020-8-3 12:45:27 | 显示全部楼层

帮你顶下哈!!

飞鱼268

发表于 2020-11-8 14:28:15 | 显示全部楼层

谢谢分享,学习了

周末

发表于 2020-11-16 14:22:11 | 显示全部楼层

很爱很爱你

发表于 2021-8-2 10:00:57 | 显示全部楼层

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

EA之家评论守则