I am having some difficulty in programing a line in my EA. I'm looking to have one of the opening conditions be that the open of the previous bar be greater than the 12 EMA. I'm doing this to try and not open trades in a sideways trending market.
Here is the actual code line:
if((Close[2] >= Close[1]) && (Open[1] >= Open[0]) && (Open[1] > ema12) && (ema12 > ema24))upcandle = true;
The ema12>ema24 code works just fine, but the Open[1] > ema12 does not work. In back testing there are several occasions where a trade is opened below the ema12.
Suggestions???
Thanks!
Here is the actual code line:
if((Close[2] >= Close[1]) && (Open[1] >= Open[0]) && (Open[1] > ema12) && (ema12 > ema24))upcandle = true;
The ema12>ema24 code works just fine, but the Open[1] > ema12 does not work. In back testing there are several occasions where a trade is opened below the ema12.
Suggestions???
Thanks!