Analysing a Trading Bot's Trade History: From Raw Data to Insights
A step-by-step way to turn a bot's trade log into insights: clean the export, compute R-multiples and costs, slice by session and regime, check MAE/MFE, and avoid false conclusions.
A bot’s trade history is the most honest record you have of what the strategy really does. Most traders only look at the final profit. A short, structured analysis of the same data usually reveals far more: where the costs go, which sessions hurt, whether stops are well placed, and whether live trading matches the backtest.
Step 1: export and clean
Export the trade list from the backtest or account. cTrader’s backtest History tab, for example, lists every opening and closing deal. Then clean it:
- One row per trade (combine opening and closing deals; handle partial closes consistently).
- Consistent time zone - convert everything to the broker’s server time or UTC, and write down which.
- Remove test trades and manual interventions, or mark them.
- Check for duplicates and missing values.
A clean table typically has: entry time, exit time, symbol, direction, volume, entry price, exit price, stop distance, gross profit, commission, swap, net profit, label/bot version.
Step 2: add useful columns
- Risk per trade = stop distance × volume × value per point.
- R-multiple = net profit / risk. Makes trades comparable over time and size.
- Costs = commission + swap + spread estimate.
- Holding time.
- Session (Asian, London, New York) and weekday.
- Regime at entry, if you record it (trend/range, volatility percentile).
- MAE and MFE if available - how far each trade moved against and in favour of you.
Step 3: start with the overall picture
Before slicing, compute:
- number of trades, expectancy in R, win rate, average win and loss in R;
- maximum drawdown in R and percent;
- costs as a share of gross profit - often the most surprising number. If costs consume 60% of gross profit, small execution changes matter more than any parameter.
Step 4: slice carefully
Group results by session, weekday, month, regime and symbol. For each group, look at number of trades and expectancy, not just total profit.
Rules for honest slicing:
- Enough trades per slice - at least about 30.
- Stable across time - a bad session should be bad in most years, not one.
- A reason - rollover spreads, illiquid hours, news times.
- Few comparisons - every extra slice increases the chance of a false finding.
Step 5: look at trade shape
- Histogram of R-multiples - are losses capped at about −1R? Losses far beyond suggest gaps, slippage or bugs.
- MAE vs result - are winners often almost stopped out (stop too tight)?
- MFE vs result - do losers often reach +1R first (a break-even rule may help)? Do winners give back much of their best excursion (exits too late)?
Step 6: compare live with backtest
For a forward-tested bot, run the backtest over the same period as the live trades and match trades one to one:
| Backtest | Live | Difference | |
|---|---|---|---|
| Trades | 48 | 45 | 3 missing - check logs |
| Avg entry slippage | 0 | 0.4 pips | Higher than assumed |
| Expectancy | 0.21R | 0.12R | Mostly explained by costs |
This separates strategy effects from execution effects.
Step 7: write down conclusions - and what you will not change
End with a short note:
- what you learned;
- what you will test next (one change at a time);
- which differences you decided were noise.
The last point matters: most patterns in trade data are random. Writing down that you looked and decided not to act protects you from changing the bot every week.
A worked example
A gold breakout bot shows 0.15R expectancy over 600 trades. The analysis finds:
- costs are 35% of gross profit;
- trades entered after 15:00 server time have −0.05R expectancy over 140 trades, negative in four of five years, when spreads widen ahead of the US close;
- 22% of losing trades reached +1R before reversing.
Two hypotheses follow: stop new entries after 15:00, and test a break-even rule at +1R. Each is then tested separately, out of sample, before any live change.
Key takeaways
- Clean the data, then express results in R and include all costs.
- Slice by session, weekday and regime - but only trust large, stable, explainable differences.
- Use R histograms and MAE/MFE to judge stops and exits.
- Compare live trades with the backtest for the same period to isolate execution effects.
Related: charts for analysing trading results.
FAQ
How many trades do I need before analysing slices such as hour of day?
Each slice needs enough trades to mean something - as a rough guide, at least 30 per category. With 200 trades split into 24 hours, most hourly slices are too small to trust.
Should I remove the hours where my bot loses?
Only if the difference is large, stable across years, and has a logical explanation (for example rollover spreads). Otherwise you are fitting the filter to noise.
Why compare live trades with backtest trades for the same period?
It isolates execution differences. If the same signals produced different entries, costs or results, the gap comes from fills, spreads or implementation, not from the strategy.
Sources and further reading
- cTrader Help: Backtest a cBot (History tab) - help.ctrader.com
- Bailey et al.: The Probability of Backtest Overfitting - papers.ssrn.com