Discussing the article: "Agent Based Market Simulation: Growing a Market From Rules, and Using It to Catch an Overfitted Strategy"

Check out the new article: Agent Based Market Simulation: Growing a Market From Rules, and Using It to Catch an Overfitted Strategy.

A compact MetaTrader 5 library builds a synthetic market from agents: a minority game, a zero‑intelligence double auction, a stylized‑facts analyzer, and a parameter scanner. The result is a testbed with known answers, providing the control real price backtests lack. Each result is cross‑checked by the model's phase transition, a matching Python implementation, and detection of a planted edge.

Every backtest has the same hole. You optimize a rule on EURUSD, get a profit factor above two, and cannot tell whether the market held the pattern or the search found the best of ten thousand accidents. Nor are those the only two readings: the result can belong to the horizon you aggregated to, the costs you left out, the metric you ranked on, or a parameter unstable a step either side. Settling any of it needs a market whose contents you already know, and real price history will never be that.

You can build one instead. Agent-based modeling grows a price series from the bottom up: define what each participant knows and how it decides, let them trade, and read the price off their collective excess demand. Nothing in it was fitted to data. Build a population whose members have no information the others lack, and a rule that scores well there is telling you about your search rather than about the market. Only for the rules you tried, though: this article tests one class, a lookback grid in two directions.

The model at the center of this library is the minority game, introduced by Challet and Zhang in 1997 from Arthur's El Farol bar problem. An odd number of agents each choose one of two sides every step, and the side chosen by fewer wins. That one rule reproduces a surprising amount of market behavior, and it comes with a published phase transition, so the implementation has an external quantity to be checked against rather than only its author's expectations.

Alongside it sits an older experiment. Gode and Sunder ran a 1993 double auction with traders who had no intelligence at all, and how much they still captured says something uncomfortable about where market efficiency comes from.

By the end you will have the library, a synthetic symbol any strategy can be tested on, and every claim below attached to a measurement the test script reproduces on your own machine.


Author: Hammad Dilber