trouble me for very long term

 

input value: T N M

A:=EMA(CLOSE,T);
B:=(LOW+HIGH+CLOSE)/3;
C:=MA(B,N);
D:=HHV(C,M);
E:=LLV(C,M);

HOW to port to MT4 platform .following is my code,but it'not work. thank u !!!!!!!!!!!!!!!!!!!!!

//+------------------------------------------------------------------+
#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=5;
int N=3;

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


//+------------------------------------------------------------------+
//| Custom indicator initialization function |
//+------------------------------------------------------------------+
int init()
{
//---- indicators
SetIndexStyle(0,DRAW_LINE);
SetIndexStyle(1,DRAW_LINE);

SetIndexBuffer(0,D);
SetIndexBuffer(1,E);

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 counted_bars=IndicatorCounted();


if (counted_bars<0) return(-1);

if (counted_bars>0) counted_bars--;

int pos=Bars-counted_bars;

double dHigh, dLow, dResult;
Comment("Hi! I'm here on the main chart windows!");

//---- main calculation loop
while(pos>=0)
{


A[pos]=iMA(NULL,0,1,0,MODE_EMA,PRICE_CLOSE,pos);
B[pos]=(Low[pos]+High[pos]+Close[pos])/3;
if(Bars<100)
continue ;
double sum = 0.0;

for (i = 0;i<N;i++)
sum += B[pos+i];

C[pos]=sum/N;

double MinVal = 0.0;
double MaxVal = 0.0;

for(i=0;i<M;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);
}

:

 
I am glad to help you .But I do not know what you do want .I'm from China.