Backtesting a Trading Strategy With Withdrawals and Deposits
Most off-the-shelf backtests assume the trading capital in your account stays fixed across the entire historical window. Real Aussie retail traders don't behave that way. They top up a Pepperstone or IC Markets account after a losing streak, withdraw profits into a high-interest savings account before EOFY, or transfer a slice across to an offshore exchange when an altcoin catches their eye. Each movement of cash changes the maths of the equity curve, and if your backtester ignores it, the numbers you see will be fiction.
The fix is event-driven modelling, where deposits and withdrawals are treated as timestamped events the same way trades are. It forces you to think carefully about return calculation, drawdown reporting, and how realistic friction layers interact with capital that is itself changing. What follows is a practical walkthrough of how to structure that kind of test, with attention to Australian brokers, AEST-timestamped logs, and ASIC-aligned reporting conventions.
Why Static Backtests Fall Apart With Real Cash Flow
A fixed-equity backtester reports a return percentage that conflates trading skill with capital timing. Start with $10,000, add another $5,000 just before a winning streak, and the reported return looks far better than the underlying edge. The reverse is equally common: a withdrawal before a recovery makes a profitable strategy look like a dud.
Consider a Sydney trader on AUD/USD who tops up after a rough week, then withdraws at EOFY for CGT management. Each of those events shifts the denominator of the return calculation, and a static backtest simply can't represent that. The result is a number that's neither an internal rate of return nor a simple time-weighted return. It's something in between, which is hard to interpret.
Without a proper cash flow ledger you cannot separate luck, skill and your own capital timing. That's the foundation of cash flow aware backtesting.
Building a Ledger of Deposits and Withdrawals
A cash flow ledger is a chronological log with at least these columns: timestamp in AEST, direction (deposit or withdrawal), amount in AUD, reason tag, and the equity balance immediately after the event. Without this structure your backtester cannot adjust the denominator at the right moment.
Granularity matters. Daily bars aren't enough if you want a serious test. Tick or minute-level data, combined with your broker's CSV export, lets you reconstruct the timeline precisely. Python with pandas, TradingView's Pine Script or MetaTrader's strategy tester can each handle this with varying degrees of comfort. Pick the one whose quirks you understand best, because every backtester hides bugs.
Watch the timestamp drift. Brokers sometimes store event time in UTC and display in AEST. A deposit that lands at 03:00 AEST but whose bar closes at 09:30 AEST can change whether the cash is "in" for a given trade. This is a small detail that meaningfully shifts reported returns on intraday strategies.
Recalculating Returns for Variable Capital
Once your ledger is in place, the next step is to choose a return formula that respects it. Three options are commonly used:
| Method | What it Measures | Strength | Weakness |
|---|---|---|---|
| Simple Return | Total gain over starting capital | Quick to read | Ignores cash flow timing |
| Time-Weighted Return | Pure manager skill | Removes deposit bias | Hard to compute without daily valuations |
| Modified Dietz | Approximate money-weighted return | One period, no full IRR solve | Less accurate around large flows |
The Modified Dietz method is the pragmatic choice for most retail setups because it does not require solving an internal rate of return for every cash flow event. It weights each cash flow by the proportion of the period remaining, then averages them. That approximation is accurate enough for monthly buckets, which fits how most Aussie traders actually move money.
Realistic Friction on AUD Currency Pairs
A backtest that ignores friction is a backtest that lies. The actual components you need to model include:
- Spread, wider on AUD/NZD than on majors, widens sharply during the AEST rollover for muted sessions.
- Commission, usually quoted per side by ASIC-licensed retail platforms like Pepperstone, IC Markets and FP Markets.
- Slippage, highly regime-dependent, but assume 0.5 to 1 pip on market orders during volatile news windows for a credible backtest.
The AEST session overlaps with both the London open and a slice of New York, which gives AUD/USD tight spreads for most of the working day but thins out overnight. If you test a session-specific edge, your slippage model has to reflect that. ASIC requires best execution on retail orders, so brokers are obliged to price reasonably, but slippage on stops is still very real when volatility spikes.
A higher-timeframe filter can also help separate noisy trades from structural ones. Filtering signals through Ichimoku clouds on the daily chart keeps your system aligned with the prevailing trend, which improves the realism of any cash flow aware backtest.
Out-of-Sample Validation and Forward Tests
A backtest that hasn't been run on unseen data is more a sales pitch than a research tool. The discipline is to hold out a recent slice of history, fit your rules on the earlier slice, then run them through the held-out window. If performance collapses, the strategy is curve-fit. This is standard practice in any quant shop and applies just as much to a part-time Aussie trader running a single AUD pair.
Beyond out-of-sample testing, paper trade the rules in real time for at least three months. Keep deposits and withdrawals in your paper ledger too, and compare the live forward equity curve with the backtest prediction. Drift between them is signal: a flat forward curve with a rising backtest is a flag, not a coincidence.
For traders who want to deepen their understanding of broker mechanics and platform-specific quirks before they finalise their friction model, Money Cafe is worth bookmarking. Combined with the walkthrough above, it gives you enough scaffolding to run a credible cash flow aware test on your own strategy.
Common Pitfalls in Cash Flow Aware Modelling
A handful of mistakes trip up traders who move from static to event-driven modelling:
- Treating deposits as profit, which inflates the equity curve and distorts drawdown reporting.
- Forgetting the CGT side, where the ATO treats each disposal as a separate event and the 50 percent discount method affects realised versus unrealised outcomes.
- Confusing the cash flow log with the trade log, which leads to double counting when you import the broker CSV.
- Modelling a strategy that is structurally flawed, particularly in altcoin markets vulnerable to coordinated pump and dump schemes.
The last point is subtle. The algorithm can be sound, but the assumption set may fail because the strategy itself has a structural flaw. That's worth being honest about before chasing a cleaner ledger.
Bringing It Together for Your Own Testing Workflow
The shortest path is to add a single new table to your engine: the deposit and withdrawal ledger, timestamped in your local zone. From there, swap the simple return formula for Modified Dietz, layer in spread, commission and a slippage estimate, then run an out-of-sample window. That sequence captures the bulk of the realism improvement.
A clean ledger will not save a random signal either. A strategy whose edge is no better than a swipe to spin mechanic will produce a tidy log and a useless equity curve. The maths cannot rescue a strategy that has no true edge, so the harder work is still on the strategy side.
The concrete next step is to pull your last six months of broker statements and start building that cash flow ledger today. Even a rough spreadsheet version, timestamped in AEST with deposit and withdrawal events marked clearly, will reveal whether your strategy's reported returns have been hiding capital timing rather than edge.