Strategy validation (min number of trades)
I hope everything is alright. I have a specific request for optimizing our strategy in MetaTrader 5. I would like to introduce a minimum sampling filter or a minimum number of trades filter. What does this mean? I want to ensure that optimized strategies are validated by a sufficient number of trades for the results to be considered statistically significant. In other words, avoid a strategy with just one or two operations (with 100% accuracy) being considered valid, as this may simply be a coincidence and not an indication of a truly effective strategy. How should it be implemented? input variable to the EA to set the minimum number of trades.During the backtest process, check the total number of trades using OrdersTotal().Penalize or discard strategies that do not meet the minimum trades criteria.Why is this important?Robustness: Ensures that the strategy is tested in various market conditions and not just specific situations. Reliability: Reduces the risk of overfitting by ensuring that we are not just picking up statistical anomalies. Consistency: Ensures that the strategy has a solid foundation and is not simply a "lucky break".I am confident that the introduction of this filter will allow us to obtain more reliable and robust optimization results. Thank you in advance for your attention and implementation of this feature. Please let me know if you need further details or clarification. Thanks and regards,
You can obtain the value of trades at the end of the backtesting in the "backtest" tab "interactively" and/or you can obtain it "automatically" if you export the result as HTML using the "terminal.exe" command line, and obtain the result, if it does not meet the number of trades you need, discard the result.
https://www.metatrader5.com/en/terminal/help/start_advanced/start