Limiting an EA to one trade

 

Hi, I'm fairly new to using MQL4. I've been trying to write an EA where a buy trade is opened if RSI(14) goes above 55, Momentum(14) above 100.2, sells if RSI(14) goes below 45 and Momentum below 99.8 with a take profit/stop loss of around 50pips. I've programmed this but I haven't been able to stop it reopening another order if the conditions are still met. Ideally I would like it to do nothing until the RSI crosses above/below 50 before opening another trade. Any ideas on how I can do this?

Thanks

 
cityguy321 wrote >>

Hi, I'm fairly new to using MQL4. I've been trying to write an EA where a buy trade is opened if RSI(14) goes above 55, Momentum(14) above 100.2, sells if RSI(14) goes below 45 and Momentum below 99.8 with a take profit/stop loss of around 50pips. I've programmed this but I haven't been able to stop it reopening another order if the conditions are still met. Ideally I would like it to do nothing until the RSI crosses above/below 50 before opening another trade. Any ideas on how I can do this?

Thanks

See here: https://www.mql5.com/en/forum/121844

Reason: