The client's idea
Mehdi Rastegar works XAUUSD on M15; the opening brief was: Turn my manual entry rules into a bot that manages the trade overnight without me.
Project and starting point
Manual M15 execution caused late entries and inconsistent sizing, and real performance could not be reviewed.
Solution architecture
Four independent modules: signal engine (EMA + RSI), risk engine, execution engine with spread control, and a position manager for trailing.
Why this design
An EMA cross confirmed by RSI is exactly what the client had been executing by hand for years. It matches how XAUUSD is actually traded and can be tested against the data already available.
Implemented capabilities
Configurable EMA period and RSI threshold, per-trade risk cap, position limit and complete event logging.
Safeguards and risk control
Per-trade risk is derived from stop distance, the daily loss cap is enforced in code, and the kill switch is independent of the signal logic.
Backtest and forward test method
Backtest over 2019–2024 with the “every tick based on real ticks” model, variable spread and commission, followed by a forward test on a demo account.
Publishable results
Execution became fully systematic and the parameters are reviewable and extensible. Performance figures are published only together with their measurement conditions.
Limitations and cautions
Results depend on tick data quality, broker spread and market conditions; they are not a guarantee of future performance.
Our next-step proposal
The next step for this project is a monthly performance report and an annual review of the XAUUSD filters.
Portfolio
Measured results
These are the figures the test produced — not a promise about future performance.
- 11.8 % Max drawdown in test
- 1,240 Trades reviewed
- 14 months Test window
- 0.4 pip Average execution slippage