[MT4-EA]ADX指标
//+------------------------------------------------------------------+
//| ADX modified_v2.mq4 |
//| Copyright 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//| |
//| Modified from default ADX by Toshi |
//| http://toshi52583.blogspot.com/ |
//+------------------------------------------------------------------+
#property copyright "Copyright 2004, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net/"
#property indicator_separate_window
#property indicator_buffers 3
#property indicator_color1 C'175,175,175'
#property indicator_color2 C'175,0,0'
#property indicator_style2 2
#property indicator_color3 C'100,100,100'
#property indicator_style3 2
#property indicator_level1 50
#property indicator_level2 0
#property indicator_level3 -50
#property indicator_levelcolor C'75,75,75'
//---- input parameters
extern int ADXPeriod=14;
//---- buffers
double ADXBuffer;
double PlusDiBuffer;
double MinusDiBuffer;
double PlusSdiBuffer;
double MinusSdiBuffer;
double TempBuffer;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- 3 additional buffers are used for counting.
IndicatorBuffers(6);
//---- indicator buffers
SetIndexBuffer(0,ADXBuffer);
SetIndexBuffer(1,PlusDiBuffer);
SetIndexBuffer(2,MinusDiBuffer);
SetIndexBuffer(3,PlusSdiBuffer);
SetIndexBuffer(4,MinusSdiBuffer);
SetIndexBuffer(5,TempBuffer);
//---- name for DataWindow and indicator subwindow label
IndicatorShortName("ADX modified("+ADXPeriod+")");
SetIndexLabel(0,"ADX modified");
SetIndexLabel(1,"+DI");
SetIndexLabel(2,"-DI");
//----
SetIndexDrawBegin(0,ADXPeriod);
SetIndexDrawBegin(1,ADXPeriod);
SetIndexDrawBegin(2,ADXPeriod);
//----
return(0);
}
//+------------------------------------------------------------------+
//| Average Directional Movement Index |
//+------------------------------------------------------------------+
int start()
{
double pdm,mdm,tr;
double price_high,price_low;
int starti,i,counted_bars=IndicatorCounted();
//----
i=Bars-2;
PlusSdiBuffer[i+1]=0;
MinusSdiBuffer[i+1]=0;
if(counted_bars>=i) i=Bars-counted_bars-1;
starti=i;
//----
while(i>=0)
{
price_low=Low;
price_high=High;
//----
pdm=price_high-High[i+1];
mdm=Low[i+1]-price_low;
if(pdm<0) pdm=0; // +DM
if(mdm<0) mdm=0; // -DM
if(pdm==mdm) { pdm=0; mdm=0; }
else if(pdm0) counted_bars--;
int limit=Bars-counted_bars;
//---- apply EMA to +DI
for(i=0; i<=limit; i++)
PlusDiBuffer=iMAOnArray(PlusSdiBuffer,Bars,ADXPeriod,0,MODE_EMA,i);
//---- apply EMA to -DI
for(i=0; i<=limit; i++)
MinusDiBuffer=iMAOnArray(MinusSdiBuffer,Bars,ADXPeriod,0,MODE_EMA,i);
//---- Directional Movement (DX)
for(i=0; i<=limit; i++)
TempBuffer=(PlusDiBuffer-MinusDiBuffer)*3;
//---- ADX is exponential moving average on DX
for(i=0; iADXmodified_v2.jpg
发表于:2015-06-07 00:29只看该作者
2楼
感谢楼主的无私分享@@
韬客社区www.talkfx.co
发表于:2016-03-18 04:56只看该作者
3楼
感谢楼主的无私分享@@
韬客社区www.talkfx.co
发表于:2016-03-21 02:39只看该作者
5楼
感谢楼主的无私分享@@
发表于:2016-03-24 10:39只看该作者
6楼
怎么使用?
韬客社区www.talkfx.co
发表于:2016-03-26 09:54只看该作者
7楼
谢谢楼主分享
韬客社区www.talkfx.co
发表于:2016-05-07 09:49只看该作者
8楼
吗色
韬客社区www.talkfx.co
发表于:2016-05-11 02:35只看该作者
10楼
看看而已,只为通宝。。。。。。
韬客社区www.talkfx.co
发表于:2016-08-09 13:44只看该作者
11楼
学习一下谢谢分享
韬客社区www.talkfx.co
发表于:2016-08-09 15:17只看该作者
12楼
回复下载
韬客社区www.talkfx.co
发表于:2017-08-08 23:21只看该作者
13楼
缺钱,灌水赚通宝,谢谢分享!!
韬客社区www.talkfx.co