#property indicator_chart_window
#property indicator_buffers 2
#property indicator_color1 clrMagenta
#property indicator_width1 2
#property indicator_color2 clrYellow
#property indicator_width2 2
//--- buffers
double a[];
double b[];
double d[];
extern int mx=10;
//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
IndicatorBuffers(8);
SetIndexStyle(0,DRAW_LINE);
SetIndexBuffer(0,b);
SetIndexStyle(1,DRAW_LINE);
SetIndexBuffer(1,d);
SetIndexBuffer(2,a);
IndicatorShortName("DKX");
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted=IndicatorCounted();
if(counted<0)return(-1);
1
if(counted>0)counted--;
int i=Bars-counted;
for(int m=0;m<i;m++)
{
a[m]=(3*Close[m]+Low[m]+Open[m]+High[m])/6;
}
for(m=0;m<i;m++)
{
b[m]=(20*a[m]+19*a[m+1]+18*a[m+2]+17*a[m+3]+16*a[m+4]+15*a[m+5]+14*a[m+6]
+13*a[m+7]+12*a[m+8]+11*a[m+9]+10*a[m+10]+9*a[m+11]+8*a[m+12]
+7*a[m+13]+6*a[m+14]+5*a[m+15]+4*a[m+16]+3*a[m+17]+2*a[m+18]+
a[m+20])/210;
}
for(m=0;m<i;m++)
{
d[m]=iMAOnArray(b,0,mx,0,MODE_SMA,m);
}
return(0);
} |