Download MetaTrader 5

Logic statement compiling error

To add comments, please log in or register
mikegreen
276
mikegreen 2016.03.04 16:20 

Hi, 

Can anyone suggest a fix for this compiling error on the || or statement:

 if(PriceHighBack>=BolUpper && PriceMedian<BolUpper || PriceHighBack>=BolUpper && PriceMedian<PriceMedianBack)

I get this compiling error:

check operator precedence for possible error; use parentheses to clarify precedence Indicator_5MinEa_Live_Xprice.mq4 102 65

Can you suggest a fix?

hope you can help??

thanks ! Mike 

 

Note:

double PriceMedian=(High[i]+Low[i])/2;

      double PriceMedianBack=(High[i+1]+Low[i+1])/2;

      double PriceLowBack=(Low[i+1]);

      double PriceHighBack=(High[i+1]); 

Carl Schreiber
6670
Carl Schreiber 2016.03.04 16:27  

Just set "(" and  ")"!

Is it (..&&..) || (..&&..)   or .. && (..||..) && .. ?

Vasyl Nosal
18636
Vasyl Nosal 2016.03.04 16:31  
if((PriceHighBack>=BolUpper && PriceMedian<BolUpper) || (PriceHighBack>=BolUpper && PriceMedian<PriceMedianBack))
mikegreen
276
mikegreen 2016.03.08 15:13  
thanks got it :)
To add comments, please log in or register