Automating Walk-Forward Backtests and Dual-Moving-Average Expert Advisors
Summary
This article shows how to automate sequential backtest windows in an MQL4 Expert Advisor. A time-check function gates trading to selected periods, with inputs for the start date, optimization length, test length, shift between windows, and window number. The article explains that these controls can reduce manual work when running and comparing repeated optimization periods.
It also outlines a dual-moving-average system using a faster and slower average to generate entry and exit signals, with separate long- and short-side settings. A JMA-based implementation is shown, and the article includes a fragment using MACD buffers and order-management functions. The discussion is instructional rather than an empirical evaluation: it reports no performance results or comparison against other methods. It cautions that optimization results are evaluated after each optimization window and recommends examining windows separately instead of relying on one genetic optimization run. The trading logic depends on indicator parameters, stop and target settings, and implementation details that readers would need to validate for their own data and platform.
Key ideas
- A time-gating function can select the dates used for each automated backtest window.
- The window number determines which optimization period is evaluated, while the shift controls how windows advance.
- The example moving-average strategy uses a faster and slower average to form crossover signals.
- Long and short trades have separately configurable indicators and risk controls.
- The article provides implementation guidance but no evidence that the strategy is profitable.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.