Why Does Bot Miss Trades in Backtesting?

 

Hello,

I've observed that sometimes trades don't execute in backtests even when all conditions in the rule set are met. For example, the strategy should theoretically enter 100 trades during the backtest period, but only 90 trades are actually generated. Does anyone know what might be causing this discrepancy?

Besides, I'm sure that all conditions are met. It occurred to me that MT5 might statistically incorporate real-world execution problems into backtests - like slippage or unfilled orders. For instance, if MT5's data shows that 1% of orders typically fail to execute in live markets, could it be factoring this into backtest simulations?

Regards...

 
  1. Back testing mode limitations - The "Every tick" mode provides the most accurate simulation, while other modes (1-minute OHLC, Open prices only) might miss execution points.
  2. Spread/slippage simulation - MT5 does indeed simulate spread widening and slippage that can prevent orders from executing, especially during volatile periods or at specific price points.
  3. Trading hours restrictions - Orders won't execute outside symbol trading sessions, even if conditions are met.
  4. Execution delay simulation - MT5 can simulate real-world execution delays that might cause missed opportunities.
  5. Order fill type settings - "Fill or Kill" orders won't execute partially, for example.

To troubleshoot:

  • Check your back test settings (especially execution mode)
  • Review specific instances where trades didn't execute by enabling detailed logs
  • Compare executed vs non-executed trades to identify patterns

MT5 does attempt to provide realistic simulations by incorporating real-world execution factors, though it does this based on predefined parameters rather than statistical models of actual failure rates.

Remember that even the most sophisticated back tests cannot fully replicate live market conditions, as they cannot account for unexpected market psychology, liquidity constraints, broker-specific issues, and the market impact of your own orders. 
 
Victor Paul Hamilton #:
  1. Back testing mode limitations - The "Every tick" mode provides the most accurate simulation, while other modes (1-minute OHLC, Open prices only) might miss execution points.
  2. Spread/slippage simulation - MT5 does indeed simulate spread widening and slippage that can prevent orders from executing, especially during volatile periods or at specific price points.
  3. Trading hours restrictions - Orders won't execute outside symbol trading sessions, even if conditions are met.
  4. Execution delay simulation - MT5 can simulate real-world execution delays that might cause missed opportunities.
  5. Order fill type settings - "Fill or Kill" orders won't execute partially, for example.

To troubleshoot:

  • Check your back test settings (especially execution mode)
  • Review specific instances where trades didn't execute by enabling detailed logs
  • Compare executed vs non-executed trades to identify patterns

MT5 does attempt to provide realistic simulations by incorporating real-world execution factors, though it does this based on predefined parameters rather than statistical models of actual failure rates.

Remember that even the most sophisticated back tests cannot fully replicate live market conditions, as they cannot account for unexpected market psychology, liquidity constraints, broker-specific issues, and the market impact of your own orders. 

Thank you for your detailed feedback 🙏
 
Victor Paul Hamilton #:
  1. Back testing mode limitations - The "Every tick" mode provides the most accurate simulation, while other modes (1-minute OHLC, Open prices only) might miss execution points.
  2. Spread/slippage simulation - MT5 does indeed simulate spread widening and slippage that can prevent orders from executing, especially during volatile periods or at specific price points.
  3. Trading hours restrictions - Orders won't execute outside symbol trading sessions, even if conditions are met.
  4. Execution delay simulation - MT5 can simulate real-world execution delays that might cause missed opportunities.
  5. Order fill type settings - "Fill or Kill" orders won't execute partially, for example.

To troubleshoot:

  • Check your back test settings (especially execution mode)
  • Review specific instances where trades didn't execute by enabling detailed logs
  • Compare executed vs non-executed trades to identify patterns

MT5 does attempt to provide realistic simulations by incorporating real-world execution factors, though it does this based on predefined parameters rather than statistical models of actual failure rates.

Remember that even the most sophisticated back tests cannot fully replicate live market conditions, as they cannot account for unexpected market psychology, liquidity constraints, broker-specific issues, and the market impact of your own orders. 

And how do you know all of those? What's the source? Are you a member of official metatrader team? Thanks again...
 
Engin All:

Besides, I'm sure that all conditions are met. It occurred to me that MT5 might statistically incorporate real-world execution problems into backtests - like slippage or unfilled orders. For instance, if MT5's data shows that 1% of orders typically fail to execute in live markets, could it be factoring this into backtest simulations?

Yes - supported.

No - not supported.

Many other aspects may be involved - everything is covered in the docs.

You need to run EA under debugger and see line by line how your trade signals are handled at the moments of failures - 100% the signal conditions are not met even if you think they do.

 
Engin All #:

And how do you know all of those? What's the source? Are you a member of official metatrader team? Thanks again...
You don’t need to be part of the official MT team to understand all that. Learning through hands-on experience can give you valuable knowledge to share with others.
 
Engin All #:

And how do you know all of those? What's the source? Are you a member of official metatrader team? Thanks again...
Hi , I am a trader 17 years and a developer .I can also tell you I can make any EA look good in back tests , back tests are not a good source that's why the majority of Ea's fail to deliver and that's why most coders for profit make grid and martingale experts they are the easiest to make look good when in reality they are ticking bombs . 
 
Victor Paul Hamilton #Hi , I am a trader 17 years and a developer .I can also tell you I can make any EA look good in back tests , back tests are not a good source that's why the majority of Ea's fail to deliver and that's why most coders for profit make grid and martingale experts they are the easiest to make look good when in reality they are ticking bombs . 

You're absolutely right that backtests can be highly misleading, especially when systems are overfitted or based on unrealistic assumptions like fixed spread, no slippage, or perfect fills.

And yes, martingale is truly dangerous by design, it's not a system but rather an illusion of recovery through lot multiplication. That said, I'd separate grid from martingale.

A pure grid (without increasing lot size) is simply a compensation-based logic, one that, depending on how it's built, can be perfectly systematic and controlled. You may like it or not, but it's still a valid strategy type, and in some cases, can be structured to work well under certain market conditions.

 
Miguel Angel Vico Alba #:

You're absolutely right that backtests can be highly misleading, especially when systems are overfitted or based on unrealistic assumptions like fixed spread, no slippage, or perfect fills.

And yes, martingale is truly dangerous by design, it's not a system but rather an illusion of recovery through lot multiplication. That said, I'd separate grid from martingale.

A pure grid (without increasing lot size) is simply a compensation-based logic, one that, depending on how it's built, can be perfectly systematic and controlled. You may like it or not, but it's still a valid strategy type, and in some cases, can be structured to work well under certain market conditions.

I get your point but grid is still dangerous and can create a false sense of security and is still suckered by trending markets .All Ea's can work in certain market conditions even martingale that's why mugs keep going back time and time again but yes a pure grid would be better than martingale but still feels like gambling to me . 
 
Victor Paul Hamilton #I get your point but grid is still dangerous and can create a false sense of security and is still suckered by trending markets .All Ea's can work in certain market conditions even martingale that's why mugs keep going back time and time again but yes a pure grid would be better than martingale but still feels like gambling to me . 

You're right that grids can be dangerous if poorly designed or left unchecked in strong trends. But just like with any strategy, the key is in the implementation and risk control.

What I meant is that a pure grid without martingale is not inherently reckless. It is just a method of market re-entry and position management. If combined with proper stop-losses, session limits, volatility filters, or even trend detection, it can avoid the gambling trap you mention and behave like a legitimate recovery or ranging strategy.

So yes, it is definitely not for everyone, but I would not throw it in the same bag as martingale. One can be structured and disciplined, the other is just mathematical denial.

 
Miguel Angel Vico Alba #:

You're right that grids can be dangerous if poorly designed or left unchecked in strong trends. But just like with any strategy, the key is in the implementation and risk control.

What I meant is that a pure grid without martingale is not inherently reckless. It is just a method of market re-entry and position management. If combined with proper stop-losses, session limits, volatility filters, or even trend detection, it can avoid the gambling trap you mention and behave like a legitimate recovery or ranging strategy.

So yes, it is definitely not for everyone, but I would not throw it in the same bag as martingale. One can be structured and disciplined, the other is just mathematical denial.

Yes structure , discipline, patience can yield results from any strategy . The strategy is just the tool .The man management of said tools is the key .