Code for EA to open a trade when three indicators give signals

 

Hi,

Newbie question here. I'm trying to code an EA so that it opens a BUY trade when ma1 reverse direction, ma2 moving up and rsi moving up.

The code I came up with is:

ma1[2]>ma1[1]<ma[0] && ma2[1]<ma2[0] && rsi[1]<rsi[0]

Would the code be correct?

Thanks!

 

ma1[2]>ma1[1]<ma[0]  - wrong, replace to

ma1[2]>ma1[1]&&ma1[1]<ma1[0]  

 
Thanks, will try!
 
Roger:

ma1[2]>ma1[1]<ma[0] - wrong, replace to

ma1[2]>ma1[1]&&ma1[1]<ma1[0]


Hi, the EA opens trade but not in the way I want it to be. The EA will only open a BUY trade if at the exact moment ma1 reverses direction, ma2 is trending up and rsi is trending up; and will open a SELL trade if the opposite occurs.

However, the EA now opens a buy trade even if ma2 only trends up a few bars after ma1 reverses direction.

Hi, Just solved the above issue. The question I want to ask now is: to how many decimals does the ma indicator calculates? Because it seems to open trade even when the ma[2]=ma[1] and the line is flat?

Please advise. Thanks!

 
Print defaults to 4 decimals. Use Print( DoubleToStr(v,8) ) to see more