Published September 23, 2026

Stop-Loss and Profit-Target Simulation: How to Replay Past Trades Under Different Exit Rules

Replay your closed trades under a different stop-loss or profit target, separate what the price record settles from what it assumes, and read the result as a range, not a forecast.


A stop-loss and profit-target simulation keeps your historical entries unchanged and asks one question of each closed trade: under a different stop and target, which level would price have reached first, and what would the trade have returned? You walk the price data forward from the original entry, find the first alternative level crossed, apply a fill assumption, and add up the replayed results beside the ones you actually got. The output is a hypothetical comparison of exit rules on one historical sample, not a record of what happened and not a forecast. How much it can be trusted depends on three things: whether the data shows the order in which price reached the two levels, what the replay assumes about fills, and how many rule variants were tried before one was picked.

This article covers the counterfactual replay: recomputing past outcomes under exit rules you did not use. Whether an exit you actually took followed the rule active at the time is a separate question, owned by exit quality diagnosis. Validating a complete systematic strategy, with entries and exits both generated by rules, is covered by backtest vs. forward test. A replay sits between the two. The entries are your own, often discretionary, and only the exit rule changes.

What does a stop-loss and profit-target replay answer?

A replay answers a narrow, conditional question: given these exact entries, how would this alternative exit rule have scored on this sample? It cannot tell you whether the alternative rule is better in general, and it says nothing about the entries themselves.

QuestionDoes a stop/target replay answer it?
Would a 1.5R target have scored differently from my 2R target on these trades?Yes, within the limits of the data and fill assumptions
Did my exits follow the rule I wrote before entry?No. That is an exit-quality question, answered from the trade record
Will the alternative rule do better on my next 100 trades?No. A historical replay does not establish future performance
Would I have actually held to the alternative rule in real time?No. The replay assumes perfect adherence to a rule you never traded
Is my entry method any good?No. Entries are held fixed by design

Keeping those questions apart matters because replay results are easy to over-read. A replay that “shows” a tighter target would have earned more is a statement about one set of past price paths, measured under assumptions you chose.

What data does a replay need?

Each trade needs its entry time and price, direction, quantity, original stop and target, actual exit time and price, and fees. It also needs price data for the period the alternative rule would have kept the trade open. That last requirement is the one most often missed.

A useful dividing line follows from it. For each trade, ask whether the alternative rule reaches one of its exit conditions (its stop, its target, or its time exit) no later than the moment you actually exited:

  • Resolved inside the holding window. If the bars between your entry and your real exit show the alternative rule reaching an exit condition by the time of the actual exit, the trade can be replayed from its own price history.
  • Unresolved at the actual exit. If none of the alternative rule’s exit conditions had been reached when you closed the trade, the replayed trade would still be open. Your journal cannot say what happened next; only market data from after the exit can.

A tighter stop or a closer target makes the first case more common, but does not guarantee it. Suppose you closed a trade by hand at +0.4R, before either the alternative stop or the alternative 1.5R target was reached. Under the alternative rule that trade is still open, however close its target, so the replay needs post-exit data. A wider stop or a farther target leaves more trades in the second case, because every trade that closed at the level being moved outward (the original stop for a wider stop, the original target for a farther target) is still open under the alternative at that moment.

Summary statistics are not a substitute for the price path. Maximum favorable excursion (MFE) and maximum adverse excursion (MAE) record how far a trade moved for and against you while it was open. They can settle some replays, as the worked example below shows. They cannot settle a trade in which both alternative levels fall inside the range the trade covered, because an extreme value does not record when it occurred. For those trades you need the bars themselves, in order. And because MFE and MAE stop at the actual exit, they say nothing about a trade the alternative rule leaves unresolved at that point. Measuring excursions consistently in the first place, including bar resolution and R units, is covered in MFE and MAE analysis.

How to replay a trade under a different stop and target

  1. Write the alternative rule before running anything. State the stop and target distances, the time exit if any, and the sizing rule, in the same form as your original plan. A rule chosen after scanning the results is a different exercise, discussed below.
  2. Put every trade in a common risk unit. Express results as multiples of the original planned risk (R) or in account currency with the sizing rule applied. If the alternative rule changes the stop distance and you size by fixed risk per trade, the position size changes too; the replay has to apply that, or it will compare two different amounts of risk.
  3. Walk forward from entry, bar by bar. For each bar after entry, check whether the alternative stop, the alternative target, or the time exit was reached. The first one reached ends the replayed trade.
  4. Classify every trade before summing. Each trade falls into one of four states:
    • Unchanged: the alternative rule produces the same exit as the original.
    • Determinable: the alternative outcome is settled by the price data you hold.
    • Ambiguous: both alternative levels fall within a single bar, or a level was touched but not traded through, so the data cannot settle which came first or whether the order filled.
    • Needs outside data: none of the alternative rule’s exit conditions had been reached by your real exit, and you do not have price data from after it.
  5. Apply explicit fill assumptions. Decide how stops, targets, and gaps fill, and use the same assumptions for every trade and every rule you compare.
  6. Report a range, not one number. Score ambiguous trades both ways, as a conservative total and an optimistic total, and keep the count of trades in each state beside the totals.

The classification step is what separates a replay from a guess. A replay that reports only one total hides how much of it rests on assumptions rather than recorded prices.

Why bar data cannot always tell which level was hit first

A price bar records four values — open, high, low, close — and nothing about the order in which the high and low occurred. If the alternative stop and target both lie inside one bar’s range, that bar alone cannot say which was reached first.

Software that simulates fills has to assume an order. TradingView’s documentation for its strategy tester is explicit about this: by default its broker emulator infers intrabar movement from each bar’s open, high, low, and close, assuming price moved open → high → low → close when the open is closer to the high, and open → low → high → close when the open is closer to the low.1 That is a reasonable default, but it is an assumption about the price path, not an observation of it. The same documentation describes an optional setting that retrieves lower-timeframe bars to increase intrabar detail, which narrows the problem without removing it.

For a replay you run yourself, two practices keep the assumption visible:

  • Drop to finer data for ambiguous bars. A one-minute or tick series often resolves a bar that looks ambiguous at a higher timeframe.
  • Default ambiguous bars to the stop. Assuming the adverse level came first is the conservative convention. Score the trade the other way as well, so the gap between the conservative and optimistic totals shows how much of the result rests on bars you could not resolve.

Fill assumptions: stops, targets, and gaps

A replay that treats every level as filling exactly at its price will tend to flatter any rule that adds target exits and understate the cost of any rule that adds stop exits. The two order types fail in different ways.

Stops do not guarantee a fill at the stop price, and the mechanics differ by market and order type. For stocks, the SEC’s investor glossary describes a stop order as becoming a market order once the stop price is reached, and notes that the execution price may differ from the stop price, especially in a fast-moving market.2 Futures exchanges define their own stop types. On CME Globex, a stop order with protection activates when the market trades at or through the trigger price and fills only within a predefined protection range around it, with any unfilled quantity resting on the book as a limit order at the protection limit; a stop-limit order becomes a limit order at its limit price, and any unfilled quantity stays on the book.3 Depending on the order type, a triggered stop can therefore fill worse than its level, fill only in part, or not fill at all in a fast move. A replay that fills every stop exactly at its level assumes away those differences, so check which order type your trades actually used before choosing a fill assumption. If an alternative rule converts more trades into stop exits, it inherits more of that exposure.

Targets resting as limit orders may not fill at all. TradingView’s documentation notes that its emulator by default fills a limit order as soon as price reaches its level, that this may not happen in a real market, and that its limit-fill setting can instead require price to move a set number of ticks beyond the level before a fill counts.1 For your own replay, the equivalent rule is simple: a target that price only touched is an ambiguous fill, not a win.

Gaps can skip order levels. If the market moves through a stop or target without trading at the order price, a fill at that level was not available. TradingView’s broker emulator, for example, treats a price-based order crossed between one bar’s close and the next bar’s open as filling at the next bar’s opening price rather than at the order level.1 A bar that opens beyond a level does not by itself prove that no trade occurred at that price, so check finer data where you have it before applying the same treatment in a manual replay, and remember that a stop crossed during a gap can produce a loss larger than 1R.

Commissions per round trip rarely change between rules that trade the same entries. Slippage does, because it depends on which order type ends each trade.

Worked example: ten trades, one alternative target

Consider a hypothetical sample of ten long trades, all planned with a stop at 1R below entry, a target at 2R above it, and a flat-by-session-close rule. The alternative rule keeps the same stop and session close but moves the target to 1.5R. Every actual exit in this sample was the stop, the target, or the session close, and the alternative keeps the same stop and session close while moving the target closer. Every replayed trade therefore reaches an exit condition no later than its actual exit, so no data from after a real exit is needed. Results are in R, before slippage.

TradeActual exitActual resultHighest point before exit (MFE)Replay at 1.5R targetReplay state
1Target+2.0R2.0R+1.5RDeterminable: price passed 1.5R on the way to 2R
2Stop−1.0R1.6R+1.5RDeterminable: the 1.6R high printed several bars before the stop
3Stop−1.0R0.3R−1.0RUnchanged
4Target+2.0R2.0R+1.5RDeterminable
5Session close+0.6R1.7R+1.5RDeterminable
6Stop−1.0R0.9R−1.0RUnchanged
7Session close−0.3R0.5R−0.3RUnchanged
8Target+2.0R2.0R+1.5RDeterminable
9Stop−1.0R1.5R (touched, not traded through)−1.0R or +1.5RAmbiguous: touch-only fill
10Stop−1.0R0.2R−1.0RUnchanged

The actual sample returned +1.3R. The replay returns +3.2R if trade 9’s touch-only target is scored as unfilled, and +5.7R if it is scored as filled.

Three readings follow from those numbers, and none of them is “move the target to 1.5R.”

  • One ambiguous trade moves the total by 2.5R, nearly double the entire actual result. The replayed range is wide because of a single touch, and a single-number report would have hidden that.
  • The improvement comes almost entirely from trades 2 and 5, where price went well into profit and then did not reach the original 2R target. Together they add 3.4R in the replay, while trades 1, 4, and 8 give back 0.5R each. On a different ten trades, with fewer reversals like 2 and 5, the same rule change could cost more than it adds.
  • Ten trades is far too few to separate a rule difference from noise. How large a sample a comparison like this needs is the question addressed in trading data statistical reliability; a ten-trade replay is an illustration, not evidence.

Now consider a second alternative on the same trades: a 2.5R target. Trades 1, 4, and 8 closed at the old 2R target, so whether they would have reached 2.5R depends on price action after the real exit. Without that later data, three of ten trades cannot be replayed at all — the unresolved-at-exit case from the data section.

Widening the stop has a subtler effect, and it needs two units kept apart: D, the price distance from entry to the original stop, and R, the planned monetary risk per trade. Suppose the stop is widened from D to 1.5D while dollar risk per trade stays fixed at 1R. Position size becomes 1 / 1.5, or two-thirds of the original. A target still located 2D from entry then returns 2 / 1.5 ≈ 1.33R, not 2R. The replay has to apply the resize, or it will credit the wider stop with gains earned at a size the rule would not have allowed.

The more rules you test, the less the best one means

Replay tools make it cheap to try many combinations: every stop from 0.5R to 2R, every target from 1R to 4R, in fine steps. The combination that scores best on your history is then the one that fit your history’s specific price paths most closely.

Bailey, Borwein, López de Prado, and Zhu showed that a spuriously high backtested result is easy to reach after testing a relatively small number of alternative configurations, and that the probability of an overfit backtest rises with the number of configurations tried.4 White described the same hazard as data snooping — the reuse of one dataset for both choosing and evaluating a model — and noted that it is practically unavoidable in time-series analysis, where only one history is available.5 A trader’s own trade history is exactly that kind of single history.

A few practices keep a stop/target replay honest:

  • Choose a small set of candidate rules before running the replay, each with a reason that does not come from the replay itself, such as observed volatility or where the setup’s premise is invalidated.
  • Keep a holdout. Replay the candidates on older trades, pick at most one, then check it on recent trades that played no part in the choice.
  • Report every variant you tested, not only the winner. The number of variants tried is part of the result.
  • Compare against the rule you actually used, on the same trades with the same fill assumptions, rather than against an idealized exit.

Outcome knowledge adds a second pull. Fischhoff found that people told how an event turned out judged that outcome as more likely in hindsight than people who were not told, and were largely unaware of the effect.6 In a replay, every price path is already known. A target that “obviously” should have been at 1.5R was not obvious at entry, and the replay cannot recreate what the trader saw then.

What a replay cannot tell you

Even a clean replay, with resolved bars, conservative fills, and a holdout check, leaves several questions open.

  • Whether you would have followed the alternative rule. The replay assumes perfect adherence. A closer target or wider stop changes how a trade feels while open, and the rule you would have executed under pressure may differ from the one you simulated.
  • Knock-on effects. Different exits change daily P&L, which can trip or avoid a daily loss limit, change how many further trades were taken, and alter which later setups were available. Per-trade replay holds all of that fixed.
  • Market conditions outside the sample. The replay describes how the rule met these price paths. Volatility, liquidity, and the instruments traded can change.
  • Whether the entries still hold. If your entry process has changed since the sampled trades, the replay is measuring exits attached to entries you no longer take.

A replay result is best treated as a hypothesis about an exit rule, to be written into the plan as a proposed change and then checked prospectively, the same way any rule change is evaluated before it replaces the old one.

Replay, exit-quality review, and backtesting compared

Exit quality diagnosisStop/target replayStrategy backtest
QuestionDid this exit follow the rule active at the time?How would a different exit rule have scored on these entries?How would a fully specified rule set have performed on history?
EntriesYour actual entriesYour actual entries, held fixedGenerated by the rules
ExitsYour actual exitsSimulated under the alternative ruleSimulated under the rules
EvidenceThe trade record: rule, timestamps, recorded informationPrice data plus fill and ordering assumptionsPrice data plus fill and ordering assumptions
Main failureGrading the exit by P&LTreating a replayed total as a forecast; selecting the best of many variantsOverfitting; unrealistic fills

The diagnosis and the replay use the same trades for different purposes. A pressure-changed exit stays a pressure-changed exit even if a replay later shows the alternative rule would have done the same thing. The replay informs what the rule should be going forward, not how any past exit is classified.

Where Costante fits

Costante supports the record a replay starts from: writing the planned stop, target, and management rule before entry, logging in-session changes, and reviewing actual exits against that plan afterward. With those fields written down before the trade, a replay compares an alternative against the rule you actually planned, not against one reconstructed from memory.

Costante does not run replays or simulations, import price data, backtest rules, connect to brokers, or recommend where a stop or target should sit. The replay itself happens in a charting or backtesting tool, or a spreadsheet with market data, and the decision to change an exit rule remains the trader’s.

Frequently asked questions

Is a stop-loss and profit-target simulator the same as a backtest?

It is a narrow kind of backtest. A full strategy backtest generates both entries and exits from rules; a stop/target replay keeps your historical entries and changes only the exit rule. That makes it usable for discretionary traders whose entries cannot be coded, but it inherits the same fill, ordering, and overfitting problems as any other backtest.

Can I replay trades from MFE and MAE instead of price bars?

Sometimes, but only when they are measured over the window in which the alternative trade would still have been open. If the alternative rule has a time exit or another exit condition that would end the trade before your actual exit, price movement after that point cannot count, even if a full-trade MFE shows the target was reached; a journal’s MFE and MAE, which usually cover the whole holding period, then need to be recomputed over the shorter window. Within the right window, if exactly one of the alternative rule’s levels falls inside the range covered, MFE and MAE can settle the result. The original exit can also fix the order: a trade that ended at its original stop, and reached a closer alternative target on an earlier bar, hit that target first. When both alternative levels fall inside that range, the extremes do not record which came first, and you need the bars in order. When neither level, nor any other exit condition of the alternative rule, was reached before the actual exit, the replayed trade is still open, and only price data from after the exit can settle it.

How many trades does a replay need?

Enough that the difference between two rules is larger than the variation you would expect from chance on a sample that size, and enough that a few ambiguous trades cannot swing the answer. The worked example above shows a single ambiguous trade moving a ten-trade total by 2.5R. Treat small-sample replays as illustrations, and check any rule you adopt on trades that played no part in choosing it.

Should I change my stop or target if the replay looks better?

Not on the replay alone. Record the proposed change, the number of variants you tested, and the range of replayed results, then trial it prospectively as a written rule change. The replay shows how the alternative rule met past prices; it does not show that it will meet future ones the same way, or that you will execute it the same way.

Sources

Costante provides educational workflow tools, not financial advice. Trading involves risk.

Footnotes

  1. TradingView. Strategies, Pine Script v6 User Manual: sections “Broker emulator” and “Slippage and unfilled limits.” Accessed September 23, 2026. ↩ ↩2 ↩3

  2. U.S. Securities and Exchange Commission, Investor.gov. Stop Order, glossary entry. Accessed September 23, 2026. ↩

  3. CME Group Client Systems Wiki. Order Types for Futures and Options: sections “Stop-Limit Order” and “Stop Order with Protection.” Accessed September 23, 2026. ↩

  4. Bailey, D. H., Borwein, J. M., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471. ↩

  5. White, H. (2000). A Reality Check for Data Snooping. Econometrica, 68(5), 1097–1126. ↩

  6. Fischhoff, B. (1975). Hindsight ≠ foresight: The effect of outcome knowledge on judgment under uncertainty. Journal of Experimental Psychology: Human Perception and Performance, 1(3), 288–299. ↩