Problem with backtesting and trading results

 

Please see attached screenshot with the two highlighted lines. The same EA during forward testing, put in the opposite order what was done during backtest. How can this be so out of whack?

 
Could you please past your EA code? Without code we can't find any solution.
Reason: