DIDI Index - Code for Wealth Lab
Author: uspacheco
Creation Date: 11/12/2009 4:02 PM
profile picture

uspacheco

#1
Hi !

Please, I do use a great indicator combined with ADX called DIDI Index. You can find a screen pic at this link http://forum.mql4.com/c/forum/2008/12/btow3.jpg

I'd like to share this with you and also ask you If it is possible to translate this to be used with Wealth Lab.

Thank you ! :)


For Metastock it is:

Mov(C,3,E) - Mov(C,8,E);
0;
Mov(C,20,E) - Mov(C,8,E);

And for Metatrade ( MQL4 Language ):


#property copyright "xxxxx "
#property link "xxxxx?"

#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Red
#property indicator_color2 Olive

#property indicator_level1 0.0
#property indicator_levelcolor White
#property indicator_levelwidth 2
#property indicator_levelstyle STYLE_SOLID





//---- input parameters

extern int didi_ema1=3;
extern int didi_ema2=8;
extern int didi_ema3=20;
extern int didi_ema4=8;

//---- buffers
double ExtMapBuffer1[];
double ExtMapBuffer2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,ExtMapBuffer1);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,ExtMapBuffer2);

//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}

/*
string get_time_frame()
{
switch(Period())
{
case PERIOD_M1 : return("M1");
case PERIOD_M5 : return("M5");
case PERIOD_M15 : return("M15");
case PERIOD_M30 : return("M30");
case PERIOD_H1 : return("H1");
case PERIOD_H4 : return("H4");
case PERIOD_D1 : return("D1");
case PERIOD_W1 : return("W1");
case PERIOD_MN1 : return("MN1");
}
}
*/

//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+



int start()
{
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--;
int limit=Bars-counted_bars;
for(int i=0;i<limit;i++)
{
double dif1 = iMA(Symbol(),0,didi_ema1,0,MODE_SMA,PRICE_CLOSE,i)-
iMA(Symbol(),0,didi_ema2,0,MODE_SMA,PRICE_CLOSE,i);
double dif2 = iMA(Symbol(),0,didi_ema3,0,MODE_SMA,PRICE_CLOSE,i)-
iMA(Symbol(),0,didi_ema4,0,MODE_SMA,PRICE_CLOSE,i);
ExtMapBuffer1[i]=dif1;
ExtMapBuffer2[i]=dif2;
}
return(0);
}

profile picture

Eugene

#2
Hi,

Yes, it's easily possible in Wealth-Lab. It's a MACD-like oscillator, just like Bill Williams' "Awesome" Oscillator. No need to code, all it takes is:

1. Feel free to take a free, unrestricted 30-day trial of Wealth-Lab Developer 5.5.
2. Download Community.Indicators.
3. Use the MACDEx indicator's customizable parameters to specify the periods for the 2 moving averages. Voila.
profile picture

uspacheco

#3
Thank you ! =))