VALYNOX
VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Entries, exits and risk control

Time stop trading: exit after N bars and how to test whether it helps

A time stop closes a trade after a fixed number of bars, whatever the price. It helps only when the entry's edge fades faster than the trade is normally held, so read N from your own trades' open profit by bar, sweep the neighbours of N, and test it next to a price stop rather than instead of one.

By · Published · updated · Editorial policy

Contents
  1. What is a time stop in trading?
  2. How many bars should a time stop be?
  3. Time stop vs stop loss: which is better?
  4. Bar count or end of day exit: which one fits your strategy?
  5. Does a time stop suit mean reversion or trend rules?
  6. What does an ES backtest show about holding time?
  7. How much does position size change the same trades?
  8. Frequently asked questions
  9. References

What is a time stop in trading?

Time stop trading means closing a trade after a fixed number of bars, whatever the price is at that moment. It helps a futures strategy only when the edge of the entry fades faster than the trade is normally held. If the edge lasts longer than the hold, a time stop removes the trades that pay for the strategy.

A time stop is an exit rule that closes a position after a set number of bars since entry, regardless of profit or loss. Think of a parking meter: when the time runs out, you move the car, whether the shopping is finished or not. The meter does not care how the shopping went. In the same way, a time stop fires on the bar count alone, so a trade that is slightly up and a trade that is flat both leave on the same bar.

A time stop exits on the bar count alone: two trades start at bar 0, one drifts slightly up and one stays flat, and both leave at the same exit marker on bar 8 Exit on the bar count Two trades, both leave on bar 8 Exit after N bars Up a bit Flat 0 1 2 3 4 5 6 7 8 The exit counts bars, not price. So: find when your edge is spent.
A time stop fires on the bar count alone. Both trades leave on bar 8, whatever price has done.

Whether the exit sounds sensible does not matter. What matters is whether the exit changes the average trade after costs. That depends on one thing: how long the signal's information stays useful compared with how long the strategy normally stays in a trade.

How many bars should a time stop be?

Pick N from the holding-time profile of the strategy's own trades, at the bar where average open profit stops growing, and trust it only if neighbouring values of N behave alike. Holding time is the number of bars between a trade's entry and its exit. The holding-time profile is a table of the average open profit of all trades still open at bar 1, bar 2, bar 3 and so on after entry.

The idea is to find the bar where the trades, on average, have taken what the signal had to give. After that bar, holding on adds noise and cost but no edge. That knee in the curve is the candidate N.

Hypothetical example

A strategy's trades show these average open profits per trade still open, in dollars: bar 1 $40, bar 2 $90, bar 3 $140, bar 4 $180, bar 5 $210, bar 6 $220, bar 7 $222, bar 8 $218, and roughly $215 to $220 from bar 9 to bar 15. Growth stops around bar 5 to 6, so the candidate N is 6. The neighbours from N = 4 to N = 8 all sit between $180 and $222, so the region is flat and the choice is not a lucky spike. With a round-trip cost of $45, the average trade after costs changes by only a few dollars across that band.

Hypothetical bar chart of average open profit at bars 1 to 15 after entry: 40, 90, 140, 180, 210, 220 and 222 dollars, then about 215 to 220 dollars; the knee at bar 6 is the candidate N and bars 4 to 8 form a flat band of neighbours Pick N at the plateau Average open profit by bar, hypothetical Neighbours alike 1 Candidate N 15 Profit stops growing near bar 6. So: keep N only if 4 to 8 agree.
Hypothetical numbers from the example box. N is read where average open profit stops growing, and the shaded band shows that neighbouring N values behave alike.

The order of steps matters, because a time stop is one more parameter that can be tuned to noise. Pardo (2008) describes the general method: change one setting at a time, look at the whole region of values, and prefer a flat region to a single best point. The same plateau logic is explained for other settings in parameter stability: plateau or lucky spike.

  1. Run the strategy without any time stop. This is the baseline.
  2. Record, for every trade, the bars held and the open profit at each bar.
  3. Pick N at the plateau of average open profit.
  4. Sweep N over its neighbours, for example N − 2 to N + 2, and compare the average trade after costs.
  5. Keep N only if the region is flat and the out-of-sample period agrees.
Five steps in order to test a time stop: run a baseline without it, record bars held and open profit per bar, pick N at the plateau, sweep N over its neighbours after costs, and keep N only if the region is flat and out-of-sample agrees Test N in five steps One change at a time, in order 1 2 3 4 5 Run baseline, no time stop Record bars held and open profit Pick N at the plateau Sweep N−2 to N+2 after costs Keep N if flat and OOS agrees Baseline first, then a narrow sweep. So: keep N only on a flat region.
The order of steps for testing a time stop without tuning it to noise.

Every run in the sweep must use the same costs and the same fill rule, or the comparison measures the settings instead of N. In AlphaPrime (Valynox), backtesting charges commission, slippage and next-bar execution inside every evaluation, so the N = 4 run and the N = 8 run differ in nothing except the exit bar.

Time stop vs stop loss: which is better?

Neither is better, because they protect against different things: a price stop against one large loss, a time stop against capital stuck in a trade that is going nowhere. Most futures strategies test both together rather than choosing one. A stop loss is an exit at a price level set below the entry for a long or above it for a short. It fires only when price moves against the trade. A time stop fires on every trade that reaches bar N, including trades that are slightly ahead.

Time stopStop loss
TriggerBar count since entryPrice level
Protects againstCapital stuck in flat tradesOne large loss
Typical exitNear the entry priceAt a loss
Effect on time in marketDownUnchanged on most trades
When it firesAlways, at bar NOnly on adverse moves
Time stop compared with stop loss: the time stop triggers on bar count, guards against idle capital, exits near entry, shortens time held and fires always at bar N; the stop loss triggers on a price level, guards against one large loss, exits at a loss, leaves time held mostly the same and fires only on adverse moves Two stops, two jobs What each one reacts to Time stop Stop loss Trigger Guards Exit at Time held Fires Bar count Price level Idle capital Large loss Near entry A loss Shorter Mostly same Always at N Adverse only Price and time guard different risks. So: test both, in four versions.
The two stops answer different questions about a trade: how far it may go against you, and how long it may take.

Kaminski and Lo (2014) show that whether a stop rule adds or subtracts value depends on how prices tend to behave after the signal, not on the rule alone. The same holds for a time stop. So the practical test is to run four versions, no stop, price stop only, time stop only, and both, and compare the average trade after costs and the max drawdown. The choice of price stop type is its own topic, covered in fixed ticks, ATR, time or trailing stops for a futures strategy. A good distance for the price stop comes from where losing trades went before they recovered, which is what maximum adverse excursion analysis measures, and a volatility-scaled version is tested in the ATR trailing stop backtest.

Bar count or end of day exit: which one fits your strategy?

A bar-count exit measures the life of the idea, while an end of day exit avoids the overnight gap, and the right choice depends on whether the entry's edge is tied to time since entry or to the session clock. An end of day exit is a rule that closes every open position at the last bar of the trading session. It is also a time-based exit, but its clock starts at the session open, not at the entry.

Bar-count exit (time stop)End of day exit
Clock starts atThe entry barThe session open
Holding timeThe same for every tradeShorter for late entries
AvoidsDead time after the edge is spentThe overnight gap and overnight margin
Fits whenThe edge decays with bars since entryThe edge belongs to one session's flow
Can be combinedYes: exit at bar N or session end, whichever comes firstYes
One trade entered at the session open on 30-minute bars numbered 0 to 12: the time stop closes it at bar 8, the end of day exit closes it at the last session bar, and the overnight gap after the session close is what the end of day exit avoids Same trade, two exit times 30-minute bars, entry at the open Time stop Exit at bar 8 End of day Exit at the close 0 4 8 12 Overnight gap End of day holds longer, skips the gap. So: pick the clock your edge follows.
The same trade leaves at different times under the two rules. The end of day exit stays longer but avoids the overnight gap.

A simple check tells you which clock your edge follows. Group the trades by the bar of the session on which they were entered. If early entries and late entries show the same open-profit profile when counted from entry, the edge follows the entry clock, and a bar count fits. If late entries do worse at every bar, the edge is tied to the session, and an end of day exit, or an entry cutoff, fits. Many intraday futures strategies use both: exit at bar N or at the session end, whichever comes first.

Does a time stop suit mean reversion or trend rules?

Mean reversion rules usually gain from a time stop, because their edge is spent within a few bars, while trend rules usually lose, because the time stop cuts the slow winners that pay for the whole strategy. Mean reversion is a rule that enters after a stretched move and expects price to return toward a recent average. Its payoff arrives early or not at all. A trend rule enters in the direction of a move and expects it to continue; its payoff arrives late and from a minority of trades.

Hypothetical example

Mean reversion rule, average open profit per trade still open: bar 1 $60, bar 2 $110, bar 3 $140, bar 4 $150, bar 6 $110, bar 8 $50, bar 10 $0. A time stop at bar 5 leaves with about $145 of the $150 peak. Trend rule, same measure: bar 5 $80, bar 10 $200, bar 20 $450, bar 30 $700. The same time stop at bar 5 leaves with $80 and gives up the $700 that the open trade would have shown by bar 30.

Hypothetical average open profit by bars held: the mean reversion rule peaks at 150 dollars on bar 4 and decays to 0 by bar 10, so a time stop at bar 5 keeps the gain; the trend rule rises slowly from 80 dollars at bar 5 to 700 dollars at bar 30, so the same time stop cuts the winner Where the edge sits in time Open profit by bars held, hypothetical Mean reversion Trend Keeps the gain Cuts the winner 5 10 5 30 Early payoff suits a time stop. So: read the profile before N.
Hypothetical numbers from the example box. The same bar-5 time stop keeps the gain in a mean reversion rule and cuts the winner in a trend rule.

This is why the holding-time profile in the second section must come before the choice of N. A profile that peaks and decays says "time stop"; a profile that keeps rising says "no time stop, or a very long one". The shape of the profile also moves with the market state, so a rule that gains from a time stop in a ranging market can lose from it in a trending one; the ways to measure that state are described in market regime detection: three regimes and how to test them.

What does an ES backtest show about holding time?

A baseline run without any time stop shows the number a time stop would attack: time in the market. Time in market is the share of all bars on which the strategy held a position. The run below used a Williams %R rule as its only entry and exit, with no stop, no target and no filters, on ES daily bars from 2019-01-02 to 2025-06-30, long and short, one contract, with $20 commission and $25 slippage per trade. It is a stand-in rule built from a standard indicator, not a time stop test itself.

Source: AlphaPrime product engine (CPU), run 2026-10-31. ES daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $25 slippage per trade.

NumberResult
Net profit (closed trades)$78,662.5
Max drawdown$77,195
Trades280
Win rate53.93%
Profit factor1.205
Average trade$280.94
Time in market71.78%
Same ES trades, nine sizing methods, sorted from deepest to shallowest max drawdown: fixed fractional risk has the deepest drawdown but low profit, fixed contracts the highest profit with a drawdown over twice the starting capital, then fixed notional, percent of equity with the lowest profit, fixed dollar risk and volatility target with identical results, fixed ratio, equity curve trading, and Kelly with the shallowest drawdown and modest profit; lower drawdown and higher profit do not move together Same trades, nine results Net profit Max drawdown Fixed fraction Fixed contracts Fixed notional % of equity Fixed $ risk Vol target Fixed ratio Equity curve Kelly
The summary report of the stand-in %R rule, run as a baseline without a time stop. Read the time in market and the trade count before adding one. ES · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

The search kept this single candidate out of the 1,024 it tried, on return against drawdown. Picking the kept one after the fact flatters its result, because the best of many tries always carries some luck; Bailey et al. (2014) show how large that bonus can be. The numbers describe the history that was tested and nothing more, and neither the %R rule nor the reader should be credited with that money.

The figure to read for this article is 71.78% time in market with 280 trades over about six and a half years. A position was open on roughly seven bars out of ten. If a holding-time profile of these trades showed open profit flattening after a few bars, a time stop would release many of those bars, cut the exposure to overnight moves, and leave the average trade of $280.94 to be re-measured against the same $45 of cost per trade. That is the test to run, not a result to assume.

How much does position size change the same trades?

With the entries and exits of the same %R trades held fixed and only the contract count changing, every difference in net profit and max drawdown below comes from sizing alone. The second box takes the 280 trades above, gives them a $100,000 account and a cap of ten contracts, and runs nine money-management methods with each method's report defaults. Not one entry or exit moved.

Source: AlphaPrime product engine (CPU), run 2026-10-31. Same trades as the box above, capital $100,000, at most 10 contracts.

MethodNet profitMax drawdownAverage contracts
Fixed contracts$247,188$230,1453
Fixed notional$167,425$222,9832.5
Percent of equity$25,338$206,3701.87
Fixed dollar risk$151,513$183,2282.68
Fixed fractional risk$63,025$248,9953.46
Volatility target$151,513$183,2282.68
Fixed ratio$152,725$166,2082.21
Equity curve trading$82,675$123,2481.96
Kelly$72,138$83,7201.04
Net profit and max drawdown of nine money-management methods on identical trades, where only the number of contracts changes, in thousands of dollars, rounded: fixed contracts about 247 and 230; fixed notional 167 and 223; percent of equity 25 and 206; fixed dollar risk 152 and 183; fixed fractional risk 63 and 249; volatility target 152 and 183; fixed ratio 153 and 166; equity curve trading 83 and 123; Kelly 72 and 84 Only the size changed Net profit Max drawdown Fixed contracts Fixed notional Percent of equity Fixed dollar risk Fixed fractional Volatility target Fixed ratio Equity curve Kelly
Each method changes only the number of contracts on identical entries and exits. Compare the bars with the second backtest box of the same trades.

The spread is wide: fixed contracts at an average of three shows $247,188 of net profit against a $230,145 max drawdown, while Kelly at an average of 1.04 contracts shows $72,138 against $83,720. The trades are identical. This is why a time stop must be judged at one contract first. Sizing multiplies whatever the exit rule leaves, so a time stop that lifts the average trade at one contract will lift it at any size, and one that lowers it cannot be rescued by sizing. Decide the exit, then choose the size; the free position size calculator turns an account risk and a stop distance into a contract count once the exit rules are fixed.

The next step is a small one. Take your own strategy, run it once without a time stop, and export the trade list. For each trade, record the bars held and the open profit at each bar since entry. Average the open profit across trades for bar 1, bar 2 and onward, and look for the bar where the average stops growing. If it never stops growing, you have your answer already. If it does, you have a candidate N and a sweep to run.

Frequently asked questions

Does a time stop suit mean reversion?

Usually yes. A mean reversion entry expects price to return toward a recent average, and that return happens within a few bars or not at all. A time stop set just past the bar where average open profit peaks leaves before the edge decays. Confirm it on your own trades by averaging open profit by bars held and checking that neighbouring N values behave alike.

Can a time stop replace a stop loss?

No, because it does not react to price. A trade can lose far more than planned before bar N arrives. A time stop limits how long capital sits in a trade; a stop loss limits how far a trade can go against you. Most systematic futures strategies run both and test four versions: no stop, price stop only, time stop only, and both.

Is an end of day exit the same as a time stop?

Both close a trade on a clock, but the clock is different. A time stop counts bars from the entry, so every trade is held the same number of bars. An end of day exit closes at the last bar of the session, so late entries are held for fewer bars. An end of day exit also avoids the overnight gap, which a bar-count exit on intraday bars does not do by itself.

What does time in market tell you about a time stop?

Time in market is the share of bars on which the strategy held a position. A high value means many bars are spent inside trades, and some of those bars may come after the entry's edge is spent. A time stop lowers time in market. Whether that helps depends on whether the released bars were adding profit or only adding noise, which the holding-time profile shows.

References

  • Kaminski, K. M., & Lo, A. W. (2014). When Do Stop-Loss Rules Stop Losses? Journal of Financial Markets, 18, 234–254.
  • Pardo, R. (2008). The Evaluation and Optimization of Trading Strategies (2nd ed.). John Wiley & Sons.
  • Bailey, D. H., Borwein, J., 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.