Download MetaTrader 5

correcting acode with fractals for indicator

To add comments, please log in or register
Abdullah Alrai
20575
Abdullah Alrai  

         frac4hup=iFractals(NULL,PERIOD_H4,MODE_UPPER,0);
         frac4hdn=iFractals(NULL,PERIOD_H4,MODE_LOWER,0);

         frac0up=iFractals(NULL,0,MODE_UPPER,i);

         frac0dn=iFractals(NULL,0,MODE_LOWER,i);

 

      if(Low[0]<frac4hdn){b1[i]=Low[i];};
      if(High[0]>frac4hup){s1[i]=High[i];};   

iam making an indicator it has acode above

iwant to draw ablue line when the price below the lower fractal at daily on my viewed chart like 15m 5 m etc

but the result is wrong it draws unusually lines!!

note b1 is the buffer for blue line 


Oksana Berenko
2773
Oksana Berenko  
show the whole code of the indicator
Lorentzos Roussos
12549
Lorentzos Roussos  

The fractals call returns zero .
You have to :

A. Double check if there is a fractal present at every bar .
    UP Fractal       -> frac0up==High[i]

    DOWN Fractal -> frac0dn==Low[i] 

 

B. Or you have to propagate the value of the last up and down fractal within your buffers so
you have a reference to compare price to. 

To add comments, please log in or register