Guide

BACKTEST AN EXIT RULE ON TRADES YOU TOOK.

Your own filled trades are the cleanest dataset you will ever have for testing an exit. Here is how to use them.
Short answer

Take your real entries and holding periods, apply a different exit rule to each one using historical price data, and recalculate total P&L, win rate, average win, average loss and expectancy across the whole set. Because the entries and sizes are real, the only variable that changed is the exit — which makes the comparison honest in a way a conventional backtest is not.

Why your own trades beat a conventional backtest

A normal backtest generates its own entries from rules, which means you are testing the entry logic and the exit logic together, on trades you never actually took, at fills you never actually got.

Re-running your own history is narrower and far more honest. The entries are real, the fills are real, the position sizes are real, and the slippage already happened. Change only the exit and the difference in results is attributable to the exit alone.

The trade-off is that you can only learn about trades you took. It cannot tell you about setups you passed on. That is a genuine limit — but "would I have done better holding to the 21 EMA?" is answerable, and it is one of the highest-value questions in trading.

The method

1. Fix the entries

Entry price, date, direction and share count stay exactly as they were. Nothing about the entry changes, ever. The moment you also adjust entries you are back to a conventional backtest with all of its problems.

2. Define the alternative exit precisely

Vague rules cannot be tested. "Hold longer" is not a rule. Each of the common swing exits can be written as one. These are:

3. Walk each trade forward through real price data

For every trade, start at the entry date and step forward day by day, testing the rule against that day's actual high, low and close. The first day the rule triggers is your simulated exit, at that day's price.

Use the same price series conventions throughout — split-adjusted but not dividend-adjusted, so simulated exits are comparable to the raw prices you actually filled at.

4. Recalculate the whole set, not the highlights

This is where most informal testing goes wrong. It is tempting to check the rule against the three trades you remember exiting too early. Of course it looks good on those. Run it across every trade in the sample, winners and losers alike, and compare totals:

MetricWhy it has to be in the comparison
Total P&LThe headline, and the least informative on its own
Win rateMost exit changes move this, usually downward
Average win / average lossWhere the change actually shows up
ExpectancyThe honest verdict, combining the three above
Max drawdownA rule you cannot sit through is not an improvement

The traps

Look-ahead bias

The commonest and most damaging. If your rule is "sell at the high of the move," you are using information that did not exist at the time. Every rule must be decidable using only data available on the day it fires. "Close below the 21 EMA" passes. "Sell two days before the top" does not.

Testing one rule and adopting it

Test four or five. A rule that wins by 2% over your actual exits is noise. One that wins by 40% across sixty trades is a finding. And if a rule wins on total P&L but doubles your drawdown, you have not found an improvement — you have found a different risk profile.

Ignoring what the change costs you

Almost every exit that captures more of the move also lowers your win rate, because trades that were up 2% now round-trip to breakeven. If you cannot tolerate the streaks that come with a 40% win rate, a rule that is better on paper is worse in practice. The break-even maths is here.

What a result looks like

Sixty trades, actual exits, versus the same sixty held to the first close below the 21 EMA:

What you did21 EMA exit
Total P&L+$36,010+$52,140
Win rate52%44%
Average win+6.1%+12.4%
Average loss−4.3%−5.0%
Expectancy+1.11%+2.66%

The rule wins, and it wins by being wrong more often. It also requires sitting through bigger giveback on every trade. Whether that is an improvement depends on whether you would actually have held — which is the one thing no backtest can tell you.

Re-run your history under a different exit

TradePiko's simulation engine applies an alternative exit or position size to the trades you really took and recalculates total P&L, win rate, profit factor and expectancy against what actually happened — with both equity curves on one chart.

Start free trial →