Skip to content
All library documents

Applying Q-Learning to an Ilan Grid Trading System

Article MQL5 articles

Summary

The article reviews the Ilan Expert Advisor, which averages into losing positions using a grid and increasing trade sizes, then closes the basket near its average entry price. It explains why this approach can perform during quiet, sideways markets yet face severe exposure in sustained trends: successive additions grow position size and can consume available margin. The author argues that static rules do not adapt when market conditions change.

The proposed redesign adds reinforcement learning through a state-action Q-table. Market conditions are discretized into states, actions receive values updated using a Bellman-style rule, and an epsilon-greedy policy balances random exploration with choosing the currently highest-valued action. The document frames this as an adaptive extension to the grid system, but the supplied text is incomplete and does not provide enough detail to assess the full design or its results. The described approach does not establish that learning removes the grid strategy’s underlying tail risk; position limits and drawdown protections remain important considerations.

Key ideas

  • Ilan averages positions as prices move against a trade and may increase trade size at each grid level.
  • The growing exposure of a Martingale-style grid makes prolonged directional moves especially hazardous.
  • A Q-table can store estimated values for actions in discretized market states.
  • The Bellman update incorporates immediate reward and the estimated value of a following state.
  • Epsilon-greedy action selection trades off exploration and use of the current best-known action.
  • The text does not provide complete implementation details or evidence that reinforcement learning resolves grid risk.

Tags

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