ADX-箭头 -报警 请高手给改编一下 让它执行
//+------------------------------------------------------------------+//| 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_color1clrRed
#property indicator_style1STYLE_SOLID
#property indicator_width11
//--- plot DI2
#property indicator_label2"DI2"
#property indicator_type2 DRAW_LINE
#property indicator_color2clrGreen
#property indicator_style2STYLE_SOLID
#property indicator_width21
//--- plot up
#property indicator_label3"up"
#property indicator_type3 DRAW_LINE
#property indicator_color3clrRed
#property indicator_style3STYLE_SOLID
#property indicator_width31
//--- plot down
#property indicator_label4"down"
#property indicator_type4 DRAW_LINE
#property indicator_color4clrRed
#property indicator_style4STYLE_SOLID
#property indicator_width41
//--- input parameters
input int preit=14;
//--- indicator buffers
double DI1Buffer[];
double DI2Buffer[];
double DI1pBuffer[];
double DI2pBuffer[];
doubleDI1,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)
{
Alert("金叉");
jincha=Time;
}
}
upBuffer=Low-100*Point;
}
if((DI1<DI1)&&(DI11>DI22))//死叉
{
if(i==0)
{
if(jincha!=Time)
{
Alert("死叉");
jincha=Time;
}
}
} downBuffer=Low-100*Point;
}
//--- return value of prev_calculated for next call
return(rates_total);
}
//+------------------------------------------------------------------+
小手一抖,积分到手! 路过,支持一下啦 前排支持下分享 路过,支持一下啦 学习了,不错 帮你顶下哈!! 谢谢分享,学习了 {:1_179:} {:1_181:}
页:
[1]
2