EoM.mq4

 

Can anybody help me with my code?

On the last candel he draws the up-infinity line and I don't know how to fix it.

Code:


#property indicator_separate_window
//#property indicator_minimum 50
//#property indicator_maximum 50
#property indicator_buffers 1
double Buffer1[];
//--------------------------------------------------------------------
int init()
{
SetIndexStyle (0,DRAW_LINE);
SetIndexBuffer(0,Buffer1);
return(0);
}
//--------------------------------------------------------------------
int start()
{
int counted_bars=IndicatorCounted(),
limit;
if(counted_bars>0)
counted_bars--;
limit=Bars-counted_bars;
for(int i=0;i<limit;i++)
{
Buffer1[i]=(((((High[i] + Low[i])/2)-((High[i-1] + Low[i-1])/2))*(High[i] + Low[i]))/Volume[i])*1000000;
}
return(0);
}
//--------------------------------------------------------------------





 

try:

//if(counted_bars>0)
//counted_bars--;
limit=Bars-counted_bars+1;

note maybe: Volume[i]) =0;

Reason: