Backtesting not consistent with visual testing

 
Backtesting an EA on historical data produces inconsistent behaviour. For example, EA calls for exit from trade on 15-minute bar when a 2 period moving average changes direction, and is confirmed visually on chart. However, in backtester, exit is produced many bars before EA changes direction, resulting in loss of profit on trade.
1. In real or demo trading, will the trade exit on the bar identified by the EA or on some random bar?
2. What is the use of backtesting if it is not accurate?
3. Please advise what can be done to correct this situation.

Thank you for your attention.

47steps
Reason: