Skip to content
All library documents

Adaptive Trading by Selecting the Best Recent Strategy

Article MQL5 articles

Summary

This article presents an adaptive Expert Advisor that runs several strategies in virtual trading and directs real trades according to the strategy with the strongest recent performance. The example uses moving-average systems with different periods, and the implementation discussion covers object-oriented strategy classes, a shared container for strategy instances, virtual position tracking, and synchronization of real positions with the selected strategy. A stochastic strategy is also included as an example of how the design can accommodate different approaches.

The evidence is a historical EURUSD hourly example in which the adaptive equity curve often followed strategies that later performed best, while trading paused when all candidates were unprofitable. The article also warns that early results can be misleading because strategies begin with equal balances; it recommends delaying real trading until performance separates. The sample does not establish that choosing the recent winner will remain profitable out of sample, and it provides no general protection against overfitting, changing market regimes, or the costs of switching strategies.

Key ideas

  • The system simulates multiple candidate strategies and selects one for real trading based on its virtual performance.
  • The example combines moving-average strategies with different periods and includes a stochastic strategy class.
  • The adaptive system can stay out of the market when all candidate strategies are unprofitable.
  • Early performance rankings may be unstable because every strategy begins with the same virtual balance.
  • Historical results illustrate the design but do not prove that the selected strategy will remain the best.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.