DEV Community

Lei Chen
Lei Chen

Posted on

I Removed the Profit Target. The Strategy Turned Profitable — Because of One Trade.

I Removed the Profit Target. The Strategy Turned Profitable — Because of One Trade.

TL;DR: Post #14 ended with a question: the 10-bar time exit kept absorbing the trades the other exits gave up — so what happens when the limit is removed entirely and the time exit runs the bracket alone? The strategy turned profitable for the first time in this series: net +$2,420.59, Profit Factor 1.378, in our testing. But one trade — entry 2024-09-20, exit 2024-10-11 — is +$2,331.99 of that $2,420.59. Without it the net is +$88.60. And the entry stream is byte-identical to #14's, so this is the cleanest comparison in the series: every dollar of improvement comes from 16 trades that used to cap at the limit and instead ran to bar 10.

Limit 2×ATR + stop 2×ATR (#14) No limit, stop 2×ATR + 10-bar time exit (#15)
Closed trades 48 48
Limit exits 16 0 — removed
Stop exits 18 18
Time exits 14 30
Net profit −$880.55 +$2,420.59
Profit Factor 0.856 1.378
Win rate 24 / 48 (50.0%) 23 / 48 (47.9%)

The contract: one question, chosen before I looked

Post #14 pre-committed this test: same script, limit removed, stop 2×ATR, 10-bar time exit. The contract for this post is three questions, in order:

  1. Was the limit doing anything — or was it cutting winners short?
  2. Is the comparison clean this time, or does the entry stream move again?
  3. If the net turns positive, what is actually carrying it — the bracket, or a few trades?

The script is post #5's fixed RSI mean-reversion strategy, byte-identical apart from the removed limit and the title string — the compiled .py diffs clean against the #14 base except for one line and the title. Zero diagnostics from the local compiler. Same 4,089 daily bars of CSI 300 (2010-01-04 → 2026-11-06), same $10,000, same PyneCore patched runtime, no commission, no slippage.

The one-line change, in Pine:

if inTrade
    strategy.exit("Exit Long", "Long", stop=strategy.position_avg_price - atrVal * 2)
    if barsInTrade >= maxHold
        strategy.close("Long", comment="Time exit")
Enter fullscreen mode Exit fullscreen mode

And the compiled Python, verbatim from the local compiler (node bin/pine2pyne.mjs, zero diagnostics) — the only line that differs from the #14 run:

strategy.exit("Exit Long", "Long", stop=(strategy.position_avg_price - (atrVal * 2)))
Enter fullscreen mode Exit fullscreen mode

What you're checking here:

  • Does removing the limit change the net — or just move wins from one exit column to another?
  • Does a bracket change touch the entry stream again, like it did in #14?
  • If the strategy finally turns profitable, how much of the profit is one trade?

Probe 1: the exit split — the time exit is now the whole strategy

Exit reason Trades Wins Net Avg per trade Avg hold
Stop (2×ATR) 18 0 −$5,778.55 −$321.03 4.1 bars
Time (10 bars) 30 23 +$8,199.14 +$273.30 10.0 bars

There is no limit column any more. The time exit went from 14 trades to 30 — 62.5% of all exits — and it is the only exit that ever wins. The stop column is unchanged in count (18) and still has never once produced a winner. Its average loss crept up again, −$311.79 → −$321.03, for a reason Probe 2 explains: it is not the prices, it is the position size.

Two verdicts hiding in that table:

The limit was cutting winners short. In #14 the 16 limit exits averaged +$240.01. The same 16 trades, allowed to run to bar 10, are worth +$7,196.69 between them — +$449.79 each. The limit did not protect anything. It capped the upside at exactly the level where this strategy's winners were still going.

The stop is still the strategy. 18 of 48 exits are stops, 0 wins, −$5,778.55 — still the largest loss column, still larger than the time exit's average win in absolute terms ($321.03 vs $273.30). Removing the limit did not fix the stop. It just let the time exit out-earn it.

Probe 2: the matched 49 — the cleanest comparison in the series

This is the part #14 could not deliver. In #14 the wider stop ate 10 entries, so half the headline improvement was entry-stream luck. This time the entry stream did not move at all: 49 entries in #14, 49 entries in #15, identical bars, identical prices. Removing the limit lengthened 16 holds from ~3.4 bars to 10 — and not one new signal fired inside those extra windows. So the comparison is fully clean: same entries, different exits, and the delta is purely an exit effect.

Transition (#14 → #15) Trades Dollar delta Point delta
LIMIT → TIME 16 +$3,356.61 +982.30 pts
STOP → STOP 18 −$166.40 +0.00 pts
TIME → TIME 14 +$110.93 +0.00 pts
OPEN → OPEN 1 — —
Total 49 +$3,301.14 +982.30 pts

Read the point column before the dollar column. In points — the only unit that is immune to position sizing — the 18 stops are worth exactly what they were worth in #14 (+0.00 pts), and the 14 time exits are worth exactly what they were (+0.00 pts). All +982.30 points of improvement come from the 16 trades that used to hit the limit. One mechanism, one number, no confound.

Then why do the dollar deltas on the identical trades move at all? Because the script sizes at 100% of equity, so the same losing prices cost more dollars when the account is bigger. Two stops prove it:

  • Trade #15 (entry 2013-06-17): same entry price, same exit price, same bars — but 4 contracts in #15 vs 3 in #14, so −$335.99 vs −$251.99. The extra −$84.00 is sizing, not price.
  • Trade #41 (entry 2023-12-12): same prices, 3 contracts vs 2, so −$247.22 vs −$164.81. The extra −$82.41 is sizing, not price.

The TIME → TIME +$110.93 is the same effect in reverse: identical prices, bigger account, bigger dollar wins. Rule I now follow: when sizing is percent-of-equity, measure an exit change in points first and dollars second. The dollar delta (+$3,301.14) is the number you report; the point delta (+982.30 pts, all from one transition) is the number you trust.

Probe 3: a few trades carry the result — the concentration check

This is the check the moonthetrain SuperTrend series runs on every strategy, and it is the one this post cannot skip. The top 5 winners are $4,922.84 of the $8,830.95 gross profit — 55.7%. And one trade does almost all the work:

Trade Entry Exit Hold Profit
#45 2024-09-20 @ 3,192.43 2024-10-11 @ 3,969.76 10 bars (time) +$2,331.99
#14 — — 10 bars (time) +$890.00
#11 — — 10 bars (time) +$653.10
#5 — — 10 bars (time) +$550.77
#29 — — 10 bars (time) +$496.98

Trade #45 is the 2024-09-30 rally trade — the same rally that carried post #12's weekly result (61.5% of that post's gain from a single trade). It rode the entry at 3,192.43 to 3,969.76 across the ten bars that include the sharpest rally in the sample, and it exited on the time rule, not on skill: it held 10 bars because the script holds 10 bars.

The honest arithmetic: net +$2,420.59 minus trade #45 = +$88.60. Without one trade, sixteen years of this strategy is breakeven. The top 5 winners are 55.7% of all gross profit; the other 18 winners between them net +$3,908.11.

So the verdict on this post's headline is two sentences, not one: the limit was genuinely cutting winners short — that part is real, measured on 16 matched trades, +982.30 points. And the strategy is still not a profitable strategy: it is a breakeven strategy plus one rally trade. A first profitable variant is a suspect until the concentration check clears it, and this one does not clear it.

Probe 4: the gap-through didn't move — the one constant

Of the 18 stops, the same 3 filled at the exit bar's open as in #14. The extra loss vs the level the script actually set:

Gap fills Extra vs level
Stop exits 3 of 18 −$227.75
Net gap effect 3 of 18 −$227.75

Identical to #14 to the cent ($227.75, 75.92 points) — because the 18 stops are the same trades at the same prices. The verification holds too: every non-gap stop fill lands exactly on the level computed from the previous bar's ATR (distance 0.0000 ATR), same as #13 and #14. Removing the limit changed nothing about how stops fill. It only changed what the trades that don't stop are allowed to become.

Rules I now follow

  1. Count exits by reason before tuning anything. (From #13 — still the first rule. The limit column is gone and the story is still in the exit split, not the net.)
  2. A bracket change is an entry change — until proven otherwise. (From #14. This time the entry stream provably didn't move: 49 = 49, identical bars. Report the entry count alongside the exit count, or the net comparison is fiction.)
  3. Match trades before claiming an effect. (From #14. Same entry, different exit is the only clean comparison — and this post finally has one: all 49 entries matched.)
  4. Measure in points before dollars when sizing is percent-of-equity. (New. Two stops cost $166.40 more on identical prices, because the account was bigger when they fired. Points don't have that problem.)
  5. A first profitable variant is a suspect until the concentration check clears it. (New, borrowed from moonthetrain's SuperTrend series: top-5 winners' share of gross profit, and net-minus-the-biggest-trade, before any verdict. Here: 55.7%, and +$88.60 without trade #45.)
  6. Price the escape, don't just count it. (From #14. Sixteen trades escaped the limit — and they were worth +982.30 points. The count alone would have hidden which transition did the work.)

What this post gives you, and what it doesn't

This post gives you: the full exit-by-reason count with the limit removed on 4,089 daily bars (0 limit / 18 stop / 30 time), the matched-trade decomposition on an identical 49-entry stream (+982.30 points, all from LIMIT → TIME), the sizing correction that separates price effects from dollar effects (+0.00 pts on the 18 stops, −$166.40 in dollars), and the concentration check (top-5 winners 55.7% of gross profit; net ex-trade-#45 +$88.60).

This post does not give you: a profitable strategy, or a verdict on RSI mean reversion. The Profit Factor is 1.378 and the net is +$2,420.59 — but it beats buy & hold (+$1,468.22 on the same span) by $952.37, and trade #45 alone is worth $2,331.99. It also doesn't test whether the 10-bar hold is the reason the time exit works, or just the window this rally happened to fit. That is the next post, and the setup is fixed before I look at the result: same script, no limit, stop 2×ATR, 20-bar time exit.

Next in the series: the hold doubled — 10 bars vs 20, counting whether the "profitable" variant survives a longer window, or whether 10 was the lucky number.


What I couldn't verify

  • Costs. No commission, no slippage, same as every post in this series. The time exit holds 10 bars and trades 49 times in 16 years, so costs would bite less here than on a fast strategy — but "less" is not a number, and I haven't run it with costs.
  • The sizing. All dollar figures are percent-of-equity at 100% with 3 contracts in this run's size range. The point totals (+982.30 pts) travel; the dollar totals don't, because the contract count follows the equity path.
  • Whether 10 bars is special. The 10-bar hold is the script's original maxHold, picked in post #2 before any of these numbers existed. It was not tuned to this result — but it also hasn't been tested against any other hold. That is exactly what #16 does.
  • Out of sample. Same 4,089 bars as every post in the series. Nothing here has been tested on data the script hasn't already seen.

Bottom line

Removing the limit turned the strategy profitable — net +$2,420.59, PF 1.378, in our testing — and the mechanism is real: 16 trades that used to cap at 2×ATR ran to bar 10 and gained 982.30 points. But the profit is one trade deep: without the 2024-09-30 rally trade the net is +$88.60. It's a better bracket on a breakeven strategy, not a profitable strategy yet.


Do you measure a bracket change in points or in dollars — and have you ever checked how much of your backtest's profit is a single trade? I read every comment — the concentration 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 (2)

Collapse
 
alexandr_trend0x profile image
Aleksandr B. •

The points-before-dollars rule is the one I'm taking from this. One more check we use for a "the limit was cutting winners" result: run the same one-line change on a few other symbols with the entries untouched. We tried exactly this swap on a daily RSI(2) pullback (fixed 3% target vs. a close above SMA 5 or a 10-bar exit) across five crypto pairs, and the version without the target came out ahead on four of the five. If the gain shows up on one index only, it's probably the 2024-09-30 rally; if it shows up across symbols, it's more likely the mechanism.

Collapse
 
leichenbuilds profile image
Lei Chen •

Good check — and noted for a future post. I haven't run the same change on other symbols yet, so I won't claim the mechanism generalises. What the data already in hand says: post #17 ran the middle hold (15 bars) and it came out worst of the three, net −$249.40, and without trade #45 the net is −$1,425.16 — so your 2024-09-30 rally suspicion is exactly where the numbers point. The cross-symbol version of the test is the right next check, and I'll run it before claiming anything about the mechanism. Thanks for the RSI(2) example — 4 of 5 is a useful benchmark to compare against.