How to Include Rebates in an EA Backtest (Spread, Commission, Swap and Cashback)
To include a rebate in an EA backtest, model it as a negative commission per lot on top of realistic spread, commission and swap, and exclude trades your broker's terms do not pay on. Treat the rebate as a small cost offset, never as the source of the strategy's edge.
By CB-Dogs Editorial6 min read
Disclosure: CB-Dogs receives an advertising (referral) fee — sometimes called an IB commission — from brokers for accounts opened or linked through us, and returns part of it to you as cashback, the same model used by cashback and points sites. This does not change your trading costs.
On this page
A backtest is only as honest as its cost model. Many EAs look strong in a default test because the spread is optimistic, commission is missing and swap is ignored. Adding a rebate (cashback) can push the other way and make a costly strategy look better than it earns. This guide shows how to model all four costs, including the rebate, without fooling yourself. All figures below are hypothetical examples.
Key takeaways
- Model four items per trade: spread, commission, swap and rebate. Spread and swap often need realistic or worst-case inputs, not the default.
- A rebate behaves like a negative commission per lot. Keep it as a separate line so you can switch it on and off and see the strategy with and without it.
- Exclude trades your broker does not pay on. Under XMTrading's public partner terms, for example, trades of 5 minutes or less and Close By closes earn no IB commission.
- Run a sensitivity test: widen the spread, raise the commission, and set the rebate to zero. If the result only works with the rebate, the strategy has no real edge.
- MT4's tester is limited for cost modelling. A practical route is to export the trades and adjust costs in a spreadsheet afterwards.
Why backtests mislead without costs
A default backtest often uses a fixed, small spread, no commission and sometimes no swap. Real trading has variable spreads that widen at rollover and news, per-lot commission on some account types, and swap on positions held past rollover. The more trades per day your EA makes, the more these costs add up. A scalper with a thin average profit per trade can flip from profitable to losing once realistic costs are included. This is covered further in forex trading costs for EA traders.
The opposite error also occurs. If you count cashback as income but ignore that some trades are not eligible, you overstate the benefit. The goal is a test that is slightly pessimistic about costs and honest about the rebate.
The four cost lines
Spread. Use a spread that reflects live conditions for your account type, not the minimum marketing figure. For a conservative test, use an average or a high percentile, and consider extra width around rollover and major news. Record real spreads from a demo or live account over a few weeks if you can, then compare them with what your tester assumed.
Commission. If your account charges commission, include it per lot, on both sides if applicable. XMTrading's Zero account, for instance, charges 10 USD per 100,000 USD traded; on MT5 it is charged at open and at close, while on MT4 the round trip is charged at open. Check your broker's current terms rather than relying on an example.
Swap. If the EA holds positions through rollover, include swap for long and short. Swap changes over time and is tripled on Wednesday for spot FX and metals at XMTrading, so a multi-day hold can differ a lot from a flat average. Use historical or conservative swap values.
Rebate. Treat it as a negative commission per lot, so it reduces the net cost. As a hypothetical example, assume a rebate of 1.8 USDT per standard lot. This is only an illustration based on a cashback rate that can change. Your actual cashback is whatever your provider pays on actually eligible lots, so look up current figures in the provider's own rate table (for CB-Dogs, see the calculator) rather than copying the example.
Modelling it in MT5
MT5's strategy tester is the better tool for this because it is multi-thread (fast), and it can test with real tick data when you have it. The approach, rather than exact menu names, is:
- Set the spread and commission realistically. Use your broker's symbol specification and, where the tester allows, a custom symbol with the spread and per-lot commission you want. If you cannot set commission in the tester, subtract it afterwards in a spreadsheet.
- Use realistic tick data for the period. Generated ticks smooth out spread widening. Real or high-quality tick data gives a more honest picture, particularly for short-term EAs.
- Treat the rebate as a separate post-processing step. Run the test with the rebate off, export the list of deals, then compute the rebate per eligible lot and add it back. This is easier to audit than building it into a custom symbol, and you can change the assumption without re-running the test.
- Include swap by keeping swap enabled in the symbol settings, and check that long and short values are realistic.
If you do want the rebate inside the tester, the approach is to model it as a negative per-lot commission on the custom symbol. Do that only after the version without the rebate looks acceptable, so you can see how much the rebate changes the result.
Modelling it in MT4
MT4's tester has limited cost modelling and a single-thread engine, so long tests are slow. The practical route is:
- Run the backtest with the spread you consider realistic.
- Export the trade report with open time, close time, lots, profit and swap.
- In a spreadsheet, subtract commission per lot, then add the rebate per eligible lot as its own column.
The spreadsheet approach also makes the next step easy.
Exclude trades that earn no rebate
Rebates are paid only on trades the broker pays the partner on. Under XMTrading's publicly available partner terms, for example, trades lasting 5 minutes or less (open to close) and trades closed with Close By are not counted for IB commission, and churning is excluded. Other brokers have their own rules, so read the terms that apply to you.
In your exported trade list:
- Calculate holding time for every trade.
- Mark trades at or under the excluded duration.
- Sum the rebate only on the remaining lots.
Imagine an EA that makes 400 trades in the test, 0.1 lot each, which is 40 lots in total. If 300 of them close within 5 minutes, only 100 trades or 10 lots earn a rebate. At the hypothetical 1.8 USDT per standard lot, the rebate is 18 USDT, not the 72 USDT you would get if all 40 lots counted. In this example the exclusion cuts the assumed rebate by three quarters. Our guide to XM trades excluded from cashback lists the exclusions, and the guide to verifying rebate volume from trade history shows how to count eligible lots from real history.
Also consider bonus-supported trades: where margin is partly supported by bonus credit, XMTrading's terms scale the IB commission to the share of your own funds, so the rebate on those trades is proportionally lower.
Sensitivity analysis: how fragile is the result?
After you have a baseline with realistic costs, change one input at a time:
| Test | What to change | What it tells you |
|---|---|---|
| Spread stress | Widen the spread by 25% to 50% | Whether the edge survives bad fills |
| Commission stress | Raise the commission slightly | Sensitivity to account type |
| Swap stress | Use the worse of long and short | Overnight cost risk |
| Rebate off | Set the rebate to zero | Whether the strategy stands without it |
| Rebate eligibility | Vary the share of eligible lots | Dependence on holding time |
If net profit is positive only with the rebate on, the rebate is doing the work the strategy should do. If a modest spread increase wipes out the result, the edge is too thin to trade live regardless of cashback. A good test result also does not predict live results; slippage, requotes and changing spreads are not fully captured.
Do not treat the rebate as edge
A rebate lowers the cost of trading, but it is paid per lot, so it scales with volume, not skill. Increasing trade count to earn more rebate usually raises costs by more than it returns, and trades placed mainly to generate commission are churning, which broker terms may exclude and which can lead to restrictions. The healthy way to use a rebate is as a small, last-step reduction in cost on a strategy that already works without it. See chasing rebates vs trading edge and forex rebates for EA traders.
FAQ
Include it as a separate, switchable line, and judge the strategy first without it. If the strategy only works with the rebate, it has no real edge.
Risk warning: forex and CFD trading carries a high risk of losing money. Cashback does not offset trading losses. Nothing here is investment advice.
Related articles
Cashback on your XM trades — free, paid in USDT
Sign up free