Help me friends,troubles me for a very long time.thank u.

 

attached pic is K Kines of EURUSD ( Period of 2008-02-07-----------2008-04-28),I used in

another currency tools .

A:=MA(CLOSE,1);
B:=(LOW+HIGH+CLOSE)/3;
C:=MA(B,5);
D:=HHV(C,10);
E:LLV(C,10);

and I want port those codes to MT4 platform,but it does not work like the pic ? thank you

!!!!!

#property copyright "Codersguru"
#property link "https://www.forex-tsd.com"

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

int M=10;
int N=5;

double A[] ;
double B[] ;
double C[] ;
double D[] ;
double E[] ;


//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{

SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);


SetIndexBuffer(0,D);
SetIndexBuffer(1,E);
SetIndexBuffer(2,C);
SetIndexBuffer(3,A);
SetIndexBuffer(4,B);

IndicatorBuffers(2);

string short_name = "My Indicator";
IndicatorShortName(short_name);
//----

return(1);
}
//+------------------------------------------------------------------+
//| Custor indicator deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{

return(0);
}
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int n = 0,i=0;
int counted_bars=IndicatorCounted();

int pos=Bars-counted_bars-1;

Print("Bars=",Bars);

if(Bars<=M) return(0);
pos=Bars-M-1;
if(counted_bars>=M) pos=Bars-counted_bars-1;
while(pos>=0)
{
double MaxVal = 0.0;
double MinVal = 100.0;

if(pos==Bars-M-1)
{
i = Bars-2;
while(i<=pos)
{
A[i] = Close[i];
B[i]=(Low[i]+High[i]+Close[i])/3;

if(i<N-1)
{
D[i] = EMPTY_VALUE;
E[i] = EMPTY_VALUE;
i++;
continue;
}
else if((i>=N-1)&&(i<=M-1))
{
C[i] =0.0;
for(n = i-N;n<i;n++)
C[i]=C[i] + B[n];
C[i]=C[i]/N;
D[i] = EMPTY_VALUE;
E[i] = EMPTY_VALUE;
i++;
continue;
}
}
}else

{
A[pos] = Close[pos];
B[pos]=(Low[pos]+High[pos]+Close[pos])/3;

C[pos] = 0.0;
for(n = pos;n<pos+N-1;n++)
C[pos]=C[pos] + B[n];
C[pos]=C[pos]/N;

MaxVal = 0;
MinVal = 100;
for(i=0;i<M-1;i++)
{
if(MaxVal<C[pos+i])
MaxVal = C[pos+i];
if(MinVal>C[pos+i])
MinVal=C[pos+i];
}
D[pos]= MaxVal;
E[pos]= MinVal;

}
pos--;
}
return(0);
}

Reason: