Backtest no issue but run real Order Open differently

 

Hi,

I'm very new with MQL4 coding. I have an issue with my EA. Im not sure what is the problem. 

When running backtest, everything is good. But when running demo/real, a lot of unwanted Order open.

Im suspect something to do with the TimeCurrent() as I use it to differentiate between current and previous session.

 

Since it is the last time on server this doesn't seem to be a reason. I use it a lot to narrow time for opening trades and never had problem if coded correctly. If you show some example for difference between backtesting and real time execution it will be probably easier to get help.


https://docs.mql4.com/dateandtime/timecurrent

TimeCurrent - Date and Time - MQL4 Reference
TimeCurrent - Date and Time - MQL4 Reference
  • docs.mql4.com
Returns the last known server time, time of the last quote receipt for one of the symbols selected in the "Market Watch" window. In the OnTick() handler, this function returns the time of the received handled tick. In other cases (for example, call in handlers OnInit(), OnDeinit(), OnTimer() and so on) this...
Reason: