In retail ML trading the architecture is rarely the bottleneck — the features are. A small model on good features beats a deep network on raw prices almost every time. Here is what actually carries signal for a forex ONNX model, and what leaks or misleads.

First rule

Never feed raw price. Price is non-stationary; the model learns the level, not the behaviour. Use returns, and normalize.

Feature families that work

Stationarity and normalization

Compute features so their distribution is stable over time, then normalize with statistics fit on the training data only. The single biggest live/backtest divergence comes from normalizing differently in Python and in MQL5 — see the normalization bug in Strategy Tester.

Avoiding leakage

Only use information available at decision time. The current, unclosed bar is a common leak — prefer completed bars. Any feature that peeks at future bars will make the backtest glow and the live account bleed.

Fewer, stronger features

More features means more ways to overfit. Start with a compact, interpretable set, confirm each earns its place with walk-forward validation, and let the model act as a filter rather than a predictor.

Frequently asked questions

Why not feed raw price to the model?

Price is non-stationary, so the model learns the price level instead of behaviour and fails when price moves outside the trained range. Use log-returns and normalized indicators.

How many features should I use?

Fewer than you think. Every extra feature is another way to overfit. Start compact, validate with walk-forward, and drop features that don’t hold up out-of-sample.