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
- Returns — log-returns over 1..N bars, not raw close.
- Volatility — ATR, rolling std of returns; regime context.
- Momentum / trend — distance from moving averages, slope, RSI-style oscillators.
- Higher-timeframe context — the H1/H4 trend when trading M5 gives the model regime awareness.
- Session & time — hour of day, session (Asia/London/NY); spread and liquidity vary a lot.
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.
Running this live?
See which prop firms allow ONNX-driven EAs, or compare MT5 brokers for running an ML EA.