$ cat projects/trading-systems/method.md

Trading systems — method

DEMO

How the program decides, how it contains risk and how a change earns its place. Everything here ran on a demo account until the fleet was retired in October 2026, and no money results are published.

system identity and research scope

The project is an automated trading program for MetaTrader 5, a trading platform. The platform calls such a program an Expert Advisor: software that places trades on its own. It traded gold (XAUUSD) on a demo account until 2026-10-05, when every running variant was retired in a full reset, after none of the 34 combinations tested by a pre-registered rebuild showed a demonstrable edge. The repository holds two of these programs; this case study covers the main one, which combines many strategies and adapts how much it trusts each of them.

architecture and modular organization

The signal logic runs in 9 phases. Each pass runs a rotating batch of the system's 57 strategies, at most 8 per tick. A tick is a new price update, and the rotation is called round-robin: a different subset runs each time. The strategies' buy and sell votes are added up into a weighted buy score and sell score.

risk containment and execution safety

The system has 8 protection layers so that an open position is never left without management. They include: The layers were built after tracing a trade that had been left unmanaged.

  • a stop-loss on every trade, which is an order that closes the trade automatically at a set loss;
  • a per-position emergency close;
  • a hard daily loss stop;
  • taking over any positions already open when the program starts;
  • a safety sweep every 5 seconds that looks for positions nothing is managing.

research boundaries and unclaimed scope

The machine-learning model deployed with the system showed no usable ability to predict price direction. It was scored only on data kept apart from its training (an out-of-sample test), and it failed. A fresh retrain also came out at chance level. Adding inputs from longer timeframes and from trading-session data was tried as well, and rejected. Based on that evidence, the main configuration ran with the model switched off until every running variant was retired.

sequential decision pipeline

On each price update (a tick), the system first refreshes its cached data and safety state. Then, no more often than a throttle allows, it asks for a verdict of buy, sell or hold. The verdict comes from 9 phases, which include: If those tests are not met, the answer is hold.

  • running a rotating batch of the 57 strategies and adding up a weighted buy score and sell score;
  • boosting or damping groups of strategies to suit the detected market regime (trending, moving sideways, or volatile);
  • vetoing the signal when buy and sell are roughly equal;
  • deciding, either by counting votes or by comparing the scores with a threshold.

Safety checks sit on both sides of the verdict.

Before a verdict is even requested, an entry gate checks that:

  • the market is open and the connection is healthy;
  • no operator stop or emergency stop is active;
  • limits are respected, such as the maximum number of open positions and the spread (the gap between the buying and selling price).

The last phase of the verdict can also block a trade against a confirmed strong trend.

Once there is a buy or sell, three more things happen:

  • a second set of direction-specific checks runs;
  • exit levels are set from recent price volatility, as a stop-loss and a take-profit (automatic exits at a set loss or gain);
  • the trade size comes from the selected risk model. One option is Kelly sizing, a formula that sizes positions from the historical win rate and payoff.

standard testing process

A written standard testing process applies the same pipeline to every traded instrument: gold, bitcoin, ether and future ones. It sets standardized acceptance thresholds. It also has a separate standard for live A/B tests, in which a new variant trades side by side with the current one.

Every change must compile cleanly and pass a self-test before it runs. The written rule is that a change then trades as a challenger alongside the current best configuration, called the champion, on the demo account, is never swapped straight into the champion, and is judged only after at least 10 days and 40 trades. Two fixes did not take that path: an order-reliability fix and a change to the news-calendar source went to every running variant at once, champion included.

strategy promotion and retirement rules

To be promoted, a challenger must score at least 0.95 times the champion on each of three measures, over at least 40 trades and 10 days: The time minimum has already caught one false start: a challenger that looked like the likely winner early on lost that advantage as its trade count grew. At the same review, another challenger's early lead turned out to be noise.

  • profit factor, which is gross gains divided by gross losses;
  • expectancy, the average result per trade;
  • a drawdown-adjusted measure, where drawdown is the fall from a previous peak.

Strategies were also re-weighted or switched off while the system ran. An optimizer that ran on the champion raised the weight of strategies with strong results and cut or disabled weak ones; it has been off since the reset. Three further gates are optional and switched off on the champion. One example disables a strategy when even an optimistic estimate of its win rate falls below a threshold. Each gate was tested as a separate challenger. Challengers that lose are retired rather than merged into the champion. At one scheduled review all 6 challengers failed: some were removed at once, and the rest were scheduled for removal once their last open trades had closed.