EA works on real but fail on backtest?

 

Is it possible? made my idea and backtest always give poor or negative results

But on a real account it always challenge me with every loss I say "failed on backtest and now is time to break on real" but seems challenging me to not break, and after every loss it start making winnings again until recover and go further

Am just curious how a system fail on backtest and do well on real trading!!

 
Samy.H:

Is it possible? made my idea and backtest always give poor or negative results

But on a real account it always challenge me with every loss I say "failed on backtest and now is time to break on real" but seems challenging me to not break, and after every loss it start making winnings again until recover and go further

Am just curious how a system fail on backtest and do well on real trading!!

Articles

Raw Code Optimization and Tweaking for Improving Back-Test Results

Hlomohang John Borotho, 2025.05.09 11:55

Enhance your MQL5 code by optimizing logic, refining calculations, and reducing execution time to improve back-test accuracy. Fine-tune parameters, optimize loops, and eliminate inefficiencies for better performance.

 
Ryan L Johnson #:

the goal is not to optimize the code for backtesting, I know the code may make backtest unreliable

What I mean is, the same code that fail to show good results in backtest*which is just one thing to consider when trading a system live) this code do well on live trading

if the code do not show good results in backtest and raw code without optimization, the same code should break also on real trading

this is the point 

 
Samy.H #:

the goal is not to optimize the code for backtesting, I know the code may make backtest unreliable

What I mean is, the same code that fail to show good results in backtest*which is just one thing to consider when trading a system live) this code do well on live trading

if the code do not show good results in backtest and raw code without optimization, the same code should break also on real trading

this is the point 

The point of the Article to which I linked in Post #1 is: "By combining structural code refinement, performance-aware functions, and indicator optimization, we can drastically improve both the quality and speed of back-testing—bringing us closer to a consistently profitable and deployable strategy." If you don't want to backtest accurately, then simply don't read the Article... nor this Blog: Not All 99% Backtests Are Equal: How Tick Data Quality Impacts Your Strategy in MetaTrader 5 - Analytics & Forecasts - 15 July 2025 - Traders' Blogs.

In other words, your code and your settings may make backtest unreliable.

 
Samy.H:

Is it possible? made my idea and backtest always give poor or negative results

But on a real account it always challenge me with every loss I say "failed on backtest and now is time to break on real" but seems challenging me to not break, and after every loss it start making winnings again until recover and go further

Am just curious how a system fail on backtest and do well on real trading!!

I have never experienced this because usually it's the other way round, good backtest but bad live/forward testing.
 
Samy.H:
Is it possible?
In statistics, a sample of 1000 observations is considered the standard for reliability, as it filters out random noise. In trading, the time factor is equally important. A result is considered stable if it holds for 6 months, allowing the strategy to face various market phases. If a signal produces 1000+ trades over such a period, the success is likely systemic rather than a stroke of luck. However, if the backtest and live results differ on the same time interval, it is a clear sign of a bug in the code or a mismatch in trading conditions (spreads, slippage, or execution).
 
Does your EA filter news events?
Mql calendar does not activate in the strategy tester, and time filters don't backtest properly unless you make the GMT offset automatically detect changing GMT timezone on the broker.
 
Conor Mcnamara #:
[T]ime filters don't backtest properly unless you make the GMT offset automatically detect changing GMT timezone on the broker.
There's always the "lazy coder's" method... Manually adjust each time filter setting by N hours in the Tester Inputs and let the default time of the Tester do its thing.
 
So you have an EA that performs well in real life but you really want it to look good on back test , EH !! , Who Cares !! . Collect cash and pass GO!  . 
 
Victor Paul Hamilton #:
So you have an EA that performs well in real life but you really want it to look good on back test , EH !! , Who Cares !! . Collect cash and pass GO!  . 
TBH, I initially thought the same thing. Then I remembered that it's tough to verify that an EA is profitable long-term via live trading─unlike via backtesting (when performed properly). We have to assume that the OP hasn't been trading the EA live for 30 years, else the OP wouldn't have waited until now to post this backtest difficulty. The risk in live testing to determine statistical long-term profitability is potential loss of real money. Therefore, the OP has good reason to learn to backtest accurately.
 
Samy.H:

Is it possible? made my idea and backtest always give poor or negative results

But on a real account it always challenge me with every loss I say "failed on backtest and now is time to break on real" but seems challenging me to not break, and after every loss it start making winnings again until recover and go further

Am just curious how a system fail on backtest and do well on real trading!!

You have to make sure the EA is well optimized to pass on back testing before using it on live account, otherwise there is a high risk of a crashed account on live trading. Even if back testing result is not 100%, it help to tell you how rugged ur EA can be in harsh market conditions. So, work more on the EA.