Backtesting is the process of testing a trading strategy on historical data to see how it would have performed in the past. It is an essential step before risking real money. A strategy that looks good in theory might fail in practice due to transaction costs, slippage, or market conditions that differ from your assumptions. Backtesting does not guarantee future performance, but a strategy that does not work in the past is very unlikely to work in the future.
Key backtesting metrics: (1) CAGR (Compound Annual Growth Rate) — the annualized return of the strategy. A CAGR above the market benchmark (EGX30 total return) indicates the strategy adds value. (2) Maximum Drawdown — the largest peak-to-trough decline during the test period. This measures the worst-case scenario for your account. A strategy with 30% CAGR but 60% max drawdown is very risky. (3) Sharpe Ratio — risk-adjusted return = (Strategy Return - Risk-Free Rate) / Strategy Standard Deviation. Sharpe above 1.0 is good; above 2.0 is excellent.
Additional important metrics: (4) Win Rate — percentage of profitable trades. Trend-following strategies often have 35-45% win rates but high reward-to-risk ratios. Mean reversion strategies often have 60-70% win rates with smaller gains. (5) Profit Factor = Gross Profits / Gross Losses. Above 1.5 is good; above 2.0 is very good. (6) Average Win / Average Loss ratio. (7) Number of trades — too few trades means the results are not statistically significant. Aim for at least 30-50 trades per backtest.
Common backtesting pitfalls: (1) Overfitting — optimizing parameters to perfectly fit historical data, resulting in a strategy that fails on new data. If your strategy has more than 3-4 parameters, you are likely overfitting. (2) Look-ahead bias — using information that would not have been available at the time of the trade (e.g., using the day's closing price to decide to buy at the open). (3) Survivorship bias — testing only on stocks that exist today, ignoring stocks that delisted or went bankrupt.
More pitfalls: (4) Ignoring transaction costs — commissions, spreads, and slippage can turn a profitable strategy into a losing one, especially for high-frequency strategies. In Egypt, brokerage fees are typically 0.15-0.25% per trade (plus stamp tax), so each round trip costs 0.3-0.5%. (5) Cherry-picking — testing multiple strategies and only showing the one that worked best. (6) Ignoring market regime changes — a strategy that worked in a bull market may fail in a bear market.
Best practices: (1) Use out-of-sample testing — split your data into in-sample (for development) and out-of-sample (for validation). (2) Walk-forward optimization — periodically re-optimize parameters using recent data, mimicking real-world adaptation. (3) Test across multiple market regimes (bull, bear, sideways). (4) Include realistic transaction costs. (5) Test with multiple starting dates to check robustness. (6) FoudaLens provides a backtesting engine that tests strategies from April 2016 to present on EGX stocks.
Interpreting backtest results: A good strategy should show: (1) Consistent positive returns across different time periods (not just one lucky year). (2) Maximum drawdown that you can psychologically and financially tolerate. (3) Enough trades for statistical significance. (4) Results that degrade gracefully when parameters are slightly changed (robustness). (5) Performance that persists in out-of-sample testing. If any of these conditions are not met, the strategy needs more work before risking real capital. This is not financial advice.
This content is for educational purposes only and does not constitute financial advice. Always do your own research before making investment decisions.