Skip to content
All library documents

A Forex Example of Model Predictive Control and Drawdown-Based Sizing

Article MQL5 articles

Summary

This example describes a Forex Expert Advisor that combines a model predictive control decision routine with technical indicators and account-level risk adjustments. The routine estimates drift and volatility, adapts its forecast horizon, and searches combinations of two control parameters for the highest expected return. It simulates prices with geometric Brownian motion, using a Box–Muller transform to generate normal shocks, and compares the current price with a recent historical average to bias decisions. The wider system is described as using moving averages, RSI, parabolic SAR, and ATR, with dynamic stop and target levels.

Position size is adjusted according to account drawdown and consecutive losses. The article mentions tests across intraday timeframes and says the example appeared to work better intraday, but supplies no detailed performance statistics in the provided text. Important functions and implementation sections are omitted, and the expected-return calculation uses a stochastic model rather than demonstrated market forecasts. The author presents it as a simplified example and calls for thorough backtesting and forward testing; the results do not establish robustness or profitability.

Key ideas

  • The example uses model predictive control to choose buy, sell, or hold decisions from simulated expected returns.
  • It estimates drift and volatility, adjusts the forecast horizon, and searches a grid of control parameters.
  • A historical price average modifies the signal, while indicators are described as checks on trend and volatility.
  • The advisor reduces position size as drawdown grows or losses accumulate.
  • The reported intraday observation lacks detailed statistics, and the article recommends further testing.

Tags

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