Direct answer
A worked example of EA backtesting is a transparent, step-by-step numerical scenario that mimics how an expert advisor (EA) would be evaluated on historical market data. The goal is not to predict the future, but to show how the backtest inputs and assumptions (rules, entry/exit logic, position sizing, spreads/fees, and execution timing) turn a sequence of trades into summary results such as ending balance, profit, and drawdown.
Because backtesting is sensitive to details, a good worked example states every assumption used for each calculation. It also separates stable mechanics (the arithmetic and evaluation method) from variable conditions (market behavior and execution realities).
Mechanism and definition
An EA is a rule-based trading program. EA backtesting means running those rules against historical price data to produce a hypothetical trade log.
A worked example usually includes these components:
-
EA decision rules: For instance, a simplified rule might enter when price crosses a level and exit when price reaches a target or a time limit.
-
Execution assumptions: Backtests must assume how orders are filled. For example, you may assume market orders fill at the next bar’s open price, and that the EA’s stop-loss and take-profit are hit exactly when the price touches them.
-
Costs: Spreads, commissions, and swap/financing are often approximated. A worked example must state whether costs are ignored or fixed per trade.
-
Position sizing: The backtest might assume a fixed lot size, a fixed risk-per-trade, or another method.
-
Metrics: Common metrics are ending balance, net profit, and maximum drawdown. These can be computed from the trade-by-trade results.
Stable mechanics are the formulas that convert assumed fills and costs into cashflows. Variable market/provider conditions are whether future price paths and real execution behave like the assumptions.
Evidence or worked scenario example
Below is one simplified, self-contained worked example. It is intentionally artificial to make the assumptions explicit.
Assumptions
- Starting balance: $10,000.
- Instrument: use a pip value assumption of $10 per 1 pip per lot.
- Position size: 1 lot for every trade.
- Execution model: entry and exit prices are taken as the next bar’s open and the exact target/stop levels when reached (no slippage).
- Costs: $2 commission per trade and 0.0 spread cost (spread ignored in this example to keep arithmetic clear).
- Risk control: exits happen by either take-profit (TP) or stop-loss (SL).
- Trade rule outcomes in the historical window (assumed): 3 trades total.
Trade list (all inputs assumed)
- Trade 1: TP = +20 pips, SL = -10 pips → result TP hit.
- Trade 2: result SL hit with -10 pips.
- Trade 3: result TP hit with +20 pips.
Step-by-step calculations
Pip-to-cash conversion: With $10 per pip per lot and 1 lot used:
- +20 pips → +$200.
- -10 pips → -$100.
Trade cashflows (including commission):
- Trade 1: +$200 − $2 = +$198.
- Trade 2: −$100 − $2 = −$102.
- Trade 3: +$200 − $2 = +$198.
Net profit: $198 + (−$102) + $198 = +$294.
Ending balance: $10,000 + $294 = $10,294.
Drawdown calculation (one simple method)
Track the equity after each trade:
- After Trade 1: $10,198.
- After Trade 2: $10,096.
- After Trade 3: $10,294.
Maximum drawdown in this sequence is the drop from the peak ($10,198) to the trough ($10,096):
- $10,198 − $10,096 = $102.
What this example shows
The arithmetic is stable: if you use the same assumptions, you get the same equity curve and metrics. The uncertainty comes from whether the assumed fills, cost treatment, and rule-trigger behavior reflect reality.
Limitations and risks
Key limitations of worked EA backtesting examples:
-
Assumptions about execution can dominate results. Ignoring slippage, assuming perfect fills, or using zero spread can overstate performance.
-
Costs may be understated or modeled differently. Commissions, spread behavior, and financing/swap can materially change net outcomes.
-
Historical patterns do not guarantee future behavior. A rule can appear profitable in one window and fail when market regimes change.
-
Data quality matters. Missing ticks, incorrect time alignment, or price adjustments can alter whether entry/exit conditions were met.
-
Overfitting risk. If an EA’s parameters are tuned to a specific historical period, it may not generalize.