The Time Exit Fired 6 Times and Made $846. Then I Changed One Number.
TL;DR: Post #5 fixed the RSI strategy's exit bracket and found a small hero inside the wreckage: the 10-bar time exit fired 6 times, won 5 of them, and made +$845.87 while the strategy overall lost -$2,572.67. Post #5 ended with a warning of its own: "Six observations is not a finding." This post tests that warning. Same script, same feed, one input changed —
maxHoldat 5, 10, and 20. At 5 the time exit fires 18 times and loses -$110.68. At 20 it fires once and loses -$98.04. The total barely moves across all three caps ($122.60 from best to worst). The +$845.87 was a property of the number 10, not of the rule.
This post is not about finding the best maxHold. It is about checking whether a rule that fired six times deserves the paragraph post #5 gave it. The test is cheap — one input, three runs — and it is the test post #5's own rule 4 demands: vary the parameter before you praise the rule.
The setup: #5's script, one input changed
The script is post #5's fixed version, unchanged except the maxHold default. The exit uses price levels, not tick distances:
if inTrade
entryPrice = strategy.position_avg_price
strategy.exit("Exit Long", "Long", limit=entryPrice + atrVal * 2, stop=entryPrice - atrVal)
if barsInTrade >= maxHold
strategy.close("Long", comment="Time exit")
Three runs, tonight, 2026-11-17, same feed as every post in this series (CSI 300 daily, 4,089 bars, 2010-01-04 to 2026-11-06), same $10,000, same PyneCore patched runtime, no commission, no slippage. The only difference between the runs is the maxHold default: 5, 10, 20. Each run was compiled fresh with the local compiler — zero diagnostics, all three — and the maxHold = 10 run reproduces post #5 byte-identically: same trade list, same -$2,572.67. That reproduction is the control; the other two caps are the experiment.
What you're checking here:
- Does the total move when the cap moves — or is the cap just along for the ride?
- Does the time exit's +$845.87 survive a different cap, or does it evaporate?
- Do the same trades behave the same way at every cap, or does the cap change which trades exist at all?
Probe 1: the total barely moves
| maxHold 5 | maxHold 10 (#5) | maxHold 20 | |
|---|---|---|---|
| Trades (closed) | 57 | 58 | 58 |
| Net profit | -$2,450.07 | -$2,572.67 | -$2,496.75 |
| Profit Factor | 0.554 | 0.587 | 0.600 |
| Win rate | 22 / 57 (38.6%) | 19 / 58 (32.8%) | 18 / 58 (31.0%) |
| Average hold | 2.8 bars | 3.6 bars | 4.0 bars |
| Buy & hold, same span | +$1,468.22 (+14.68%) | +$1,468.22 (+14.68%) | +$1,468.22 (+14.68%) |
The spread from best to worst net is $122.60 — about 5% of the loss, on a $10,000 account, over 16 years. The Profit Factor moves from 0.554 to 0.600, and every version loses. Doubling the cap from 10 to 20 adds 0.4 bars to the average hold; halving it to 5 subtracts 0.8. The bracket still does almost all the exiting at every cap: even at 20, the average trade lasts 4 bars, and only one trade in the whole run reaches the 20-bar cap at all.
The honest reading is that the cap is not the strategy. A parameter that moves the total by $122 out of a -$2,500 loss is a parameter you can stop arguing about. That is itself a finding — just not the one a parameter sweep is usually run to produce.
Probe 2: the hero exit evaporates
The time exit, broken out by cap:
| maxHold 5 | maxHold 10 (#5) | maxHold 20 | |
|---|---|---|---|
| Time exits fired | 18 | 6 | 1 |
| Time-exit wins | 10 / 18 | 5 / 6 | 0 / 1 |
| Time-exit net | -$110.68 | +$845.87 | -$98.04 |
| Bracket-exit net | -$2,339.39 (39 trades) | -$3,418.54 (52 trades) | -$2,398.71 (57 trades) |
At cap 10 the time exit looks like the one good rule in a bad strategy: 5 of 6 winners, +$845.87. At cap 5 the same rule fires three times as often — 18 times, 10 winners — and loses -$110.68. At cap 20 it gets one chance in 58 trades and loses -$98.04. The rule did not change. The number did. The +$845.87 was a 6-trade artifact of the cap value 10, exactly as post #5's rule 4 warned it might be: "Six observations is not a finding."
Note the shape of the failure, because it is the general lesson. A time exit only ever fires on trades the bracket didn't kill first. At cap 5, the survivors are different trades than at cap 10 — the rule is sampling a different, larger set of stragglers, and that set loses money. At cap 20, almost nothing survives 20 bars, so the rule barely exists. The rule's record is not a property of the rule; it is a property of which trades happen to outlive the bracket at that particular cap. Change the cap and you change the sample, and the verdict flips with it.
Probe 3: the same trade, three caps
The trade-by-trade comparison makes the point concrete. Most trades are identical at every cap — the bracket fires first and the cap never matters. The ones that differ are the survivors, and they do not agree with each other:
| Entry | maxHold 5 | maxHold 10 | maxHold 20 |
|---|---|---|---|
| 2010-02-04 | +$30.78 (time exit) | +$137.16 (time exit) | +$367.19 (time exit) |
| 2015-07-10 | +$107.49 (time exit) | +$338.93 (time exit) | -$225.30 (bracket) |
| 2016-02-01 | -$101.22 (time exit) | +$289.78 (time exit) | +$321.84 (time exit) |
| 2025-04-10 | +$11.92 (time exit) | +$76.66 (time exit) | +$224.90 (time exit) |
Longer holds help the 2010 trade (+$31 → +$367) and hurt the 2015 trade (+$339 → -$225). There is no monotone pattern to optimize — no direction in which "longer is better" or "shorter is better" holds across trades. That is what a sensitivity check is for: if the answer depended cleanly on the cap, one of the three columns would dominate, and it doesn't.
One second-order effect worth stating plainly. The cap changes not just exits but which later trades exist: the 2018-07-10 entry appears at caps 10 and 20 and not at cap 5, because at cap 5 the strategy was still holding the previous trade when that signal fired, and the entry rule (longSignal and not inTrade) skipped it. A parameter that only touches exits still reshapes the entry list downstream. Any sweep that counts "the same N trades" at every parameter value is counting a different set of trades and should say so.
Rules I now follow
- A rule that fired six times gets a sensitivity check before it gets a paragraph. Vary the parameter first, praise it second. If the verdict flips when the parameter moves, the verdict belonged to the parameter, not the rule.
- Report every value you tried, not the best one. All three caps are in the table above, including the worst. A sweep that only reports the winning cap is a different kind of post, and not one this series writes.
- A sensitivity check is not an optimization. No cap is crowned here, because the totals differ by $122 and all three lose. "The cap doesn't matter much" is a legitimate conclusion — it tells you where not to spend your next test.
- Count what the parameter changes downstream. The cap moved exits, and the exits moved which later entries were taken. If your sweep assumes the trade list is fixed, check that assumption against the trade list.
- Six observations is not a finding — and now it is a measured one. Post #5 said it as a warning. This post measured it: the same rule, +$846 at one cap, -$111 at another, -$98 at a third.
What this post gives you, and what it doesn't
This post gives you: a three-number sensitivity check on one real rule, with the trade-by-trade table that shows why the headline flips — plus a check you can run on your own strategy in an afternoon (pick the parameter your best rule depends on, run it at half and double, report all three).
This post does not give you: a verdict on time exits in general, or on RSI mean reversion. Three caps on one symbol, one timeframe, 57–58 trades, no costs — that is enough to retire one small hero story, not enough to conclude time exits never work. It also does not prove the cap is irrelevant everywhere: on a strategy whose bracket fires less often, the cap would matter more, and that is a different test on a different strategy.
Next in the series: the same fixed strategy on the weekly feed — does the bracket survive a timeframe change, or does the exit logic fall apart when the bars get five times wider? Same script, same symbol, 862 weekly bars, no new code.
What rule in your strategy has only fired a handful of times — and have you varied its parameter to check it's real? I read every comment — the measurement stories are what the next posts are built from.
This conversion work was done by Pine2Py, the tool I build for exactly this job: paste a Pine script, get PyneCore-flavored Python back, diagnostics included when something can't be translated. The runtime is the open-source PyneCore project, with a patched build we ship for the two constructs stock PyneCore doesn't handle — details are on the site. It's free to try — every account gets 3 conversions, no card — and Pro is $12/month if you end up converting a whole library. No return promises, ever: a translator moves your logic, it doesn't make it profitable.
Top comments (0)