Is it possible that it trade only one time per condition?(Only one trade per signal)

 

HI,

I wanted t know if someone can help me out all my script is done but when i put on backtesting the EA open more than one trade when the conditions are good

My conditions are if CCI > 100 and when the candles of the chart are over the moving average it's a buy signal 

But when the buy signal is given the EA opens plenty of trades can somebody help me out?

I try that when the conditions are good that the EA only open one trade per buy signal


My code is below



Thank you,

Files:
 
Of course. Assuming that there only should be not more than1 open position check if there is a buy signal whether there is one open buy position (do nothing) and if there is a sell position or no open position open a buy position (and close the sell position).
 
  1. Check for an open order before opening. Or,

  2. Act on a change of signal.
              MQL4 (in Strategy Tester) - double testing of entry conditions - MQL4 programming forum #1 (2017)