//+------------------------------------------------------------------+
//| DMI.mq4 |
//| Copyright © 2006, Fernando Gomes. |
//| http://www.ciavox.com/~fgomes |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2006, Fernando Gomes."
#property link "http://www.ciavox.com/~fgomes"
//---- indicator settings
#property indicator_separate_window
#property indicator_buffers 5
#property indicator_color1 Lime
#property indicator_color2 Red
#property indicator_color3 Yellow
#property indicator_color4 DeepSkyBlue
#property indicator_color5 Blue
#property indicator_minimum 0
#property indicator_level1 20
#property indicator_level2 25
#property indicator_maximum 60
//---- indicator parameters
extern int Smooth = 13;
extern bool Hide_DI_Plus = False;
extern bool Hide_DI_Minus = False;
extern bool Hide_DX = False;
extern bool Hide_ADX = False;
extern bool Hide_ADXR = False;
//---- indicator buffers
double b_di_p[]; // +DM
double b_di_m[]; // -DM
double b_dmi[]; // DX (DMI itself)
double b_adx[]; // Average Directional indeX
double b_adxr[]; // Average Directional indeX Rate
//---- non-indicator buffers
//---- NOTICE that these arrays must be included in ArraySetAsSeries()
double dm_p_avg[];
double dm_m_avg[];
double tr_avg[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init() {
//---- indicator buffers mapping
IndicatorBuffers(8);
if ( !SetIndexBuffer(0,b_di_p)
&& !SetIndexBuffer(1,b_di_m)
&& !SetIndexBuffer(2,b_dmi)
&& !SetIndexBuffer(3,b_adx)
&& !SetIndexBuffer(4,b_adxr)
&& !SetIndexBuffer(5,dm_p_avg)
&& !SetIndexBuff
Comments