Gold trading bot
A bot that trades gold on a demo account, and a backtester honest enough to tell me my strategies didn't work.
- Status
- Research complete, demo only.
- Stack
- Python
- pandas
- NumPy
- MetaTrader 5
The problem
It is easy to write a trading strategy that looks profitable on paper. I wanted to know whether any of mine would survive realistic costs.
What I built
A Python bot for gold that runs the same rules three ways: a backtester, a research harness, and a live loop on a demo account. It refuses to start on a real-money account.
Making the test hard to fool
- Costs are modelled the way they bite in practice: spread on entry, slippage on every fill, overnight fees, and a bar that touches both the stop and the target counted as a loss.
- Signals act on the next bar’s open, so the test can’t peek at prices it wouldn’t have had.
- Six months of data are held back and looked at once per idea.
- Results are reported per unit of risk with an error margin, to separate an edge from luck.
Risk controls
One risk gate is shared by the backtest and live trading: a trading-hours window, a maximum spread, a fixed risk per trade, a daily loss stop, a cap on trades per day and one position at a time.
What I found
I tested ten variants across five strategy families. None showed an edge. That was the right answer to get before any money was involved.
Stack
Python, pandas, NumPy, MetaTrader 5 through a broker API. 33 automated tests covering fills, costs, risk limits and order handling.
Status
Research complete, demo only.