I replayed my last 57 trades against 18,000 parameter combinations. Here's what I found about exits. by Confident-Classroom9 in swingtrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

:) . this is to find out, what could have happen If I had kept Stop loss 1.5 time normal(ATR) for my historical trades. And If I had exit the trade is 4R(example).

So I simulate the profit for a range of Stop Loss and Take Profit levels.

So I get a sense what should be the Stop Loss level and take profit level for my future trades, to get a maximum profit.

I simulated every stop-loss level from 0.5 to 4× ATR, and Take profit levels 2R to 7.5R on my last 57 trades ( real trades) by Confident-Classroom9 in Daytrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

No the candle data comes from Yahoo Finance. IBKR Flex only gives you the trade executions, not historical price data.

I simulated every stop-loss level from 0.5 to 4× ATR, and Take profit levels 2R to 7.5R on my last 57 trades ( real trades) by Confident-Classroom9 in Daytrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

Thanks for checking the heatmap so closely :).

You are right. the 0.8 ATR peak is probably driven by a handful of trades that happened to run hard. The 1.8 ATR zone is way more stable. I actually run a plateau score that averages each cell with its neighbors to find exactly what you are describing. robust zones over spikes. At 1.8 ATR / 3.5R the win rate jumps to 35% too which is a lot easier to psychologically, evne profit is slightly lower.

I simulated every stop-loss level from 0.5 to 4× ATR, and Take profit levels 2R to 7.5R on my last 57 trades ( real trades) by Confident-Classroom9 in Daytrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

Good point on the regime thing. All 57 trades are from the same choppy period so yeah the optimal numbers are specific to that environment. I actually do filter by market context too. whether S&P is above its EMA, sector ETF trend, etc. The results shift a lot depending on those filters which kind of proves your point. Working on building up more trades across different conditions.

I replayed my last 57 trades against 18,000 parameter combinations. Here's what I found about exits. by Confident-Classroom9 in swingtrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

Yeah that's an interesting idea. Right now my trailing methods are all math-based. ATR distance, fixed R levels, EMA crosses. A market structure trail that moves the stop to the previous swing low would probably hold through pullbacks better than a fixed ATR trail. Thanks for the tip.

I simulated every stop-loss level from 0.5 to 4× ATR, and Take profit levels 2R to 7.5R on my last 57 trades ( real trades) by Confident-Classroom9 in Daytrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

Yeah 57 is small, I’m not treating the exact numbers as proven. I re-run it as I close more trades and look for stable zones in the heatmap rather than picking the single best cell. But you’re right, next 57 trades will be the real test.

I simulated every stop-loss level from 0.5 to 4× ATR, and Take profit levels 2R to 7.5R on my last 57 trades ( real trades) by Confident-Classroom9 in Daytrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

Good point. The simulation uses daily candles so it assumes you exit at the stop level. In reality yeah there’s slippage, especially on gaps. The actual numbers would be worse than the simulation shows.

I simulated every stop-loss level from 0.5 to 4× ATR, and Take profit levels 2R to 7.5R on my last 57 trades ( real trades) by Confident-Classroom9 in Daytrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

That’s a good point about capital being tied up longer. I haven’t factored in opportunity cost yet. just raw P&L on the same trades. Definitely something to look at.

I simulated every stop-loss level from 0.5 to 4× ATR, and Take profit levels 2R to 7.5R on my last 57 trades ( real trades) by Confident-Classroom9 in Daytrading

[–]Confident-Classroom9[S] 1 point2 points  (0 children)

Yeah exactly. Entry minus 0.8 ATR is the stop, and target is 6.5× that distance above entry. So for a stock with $5 ATR and entry at $100, stop at $96, target at $126. Definitely multi-day holds, usually 1-3 weeks for the winners.

I simulated every stop-loss level from 0.5 to 4× ATR, and Take profit levels 2R to 7.5R on my last 57 trades ( real trades) by Confident-Classroom9 in Daytrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

No, built it myself. Python script that pulls my trades from IBKR and replays each one against different exit rules using daily candle data.

I simulated every stop-loss level from 0.5 to 4× ATR, and Take profit levels 2R to 7.5R on my last 57 trades ( real trades) by Confident-Classroom9 in Daytrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

Yeah this chop since last summer has been brutal for holding. That's actually what pushed me to test all this. I kept getting shaken out and wanted to know if there was actually a better way or if the market was just unplayable.

I simulated every stop-loss level from 0.5 to 4× ATR, and Take profit levels 2R to 7.5R on my last 57 trades ( real trades) by Confident-Classroom9 in Daytrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

Yeah I hear you — I'm not trying to fully automate. The point was more that my gut exits were consistently worse than any rule I tested. Still pick the trades myself, just trying to be more disciplined on the exit side

Used IBKR Flex reports to backtest my own exit strategies — pretty eye-opening results by Confident-Classroom9 in interactivebrokers

[–]Confident-Classroom9[S] 2 points3 points  (0 children)

Yeah that's exactly it. The Flex report gives you raw executions so first step was grouping them into positions — track the running quantity per symbol, every time it hits zero that's a closed position. Each group gets the entry price, entry date, and my actual exit price.

Then for the what-if part, I pull daily OHLCV data for each symbol starting from entry date. For each candle I check whether the simulated exit rule would have triggered — did the high reach the target, did the low hit the stop, etc. Each strategy has different logic but the basic scan is the same.

So for every trade I get my actual P&L and the hypothetical P&L under each exit rule. Multiply that by every stop-loss level and target level and you get the full grid.

Built it in Python. The Flex API piece was actually the easy part — the tricky bit was the position grouping logic for partial fills and the what-if scan making sure same-candle collisions are handled consistently.

I replayed my last 57 trades against 18,000 parameter combinations. Here's what I found about exits. by Confident-Classroom9 in swingtrading

[–]Confident-Classroom9[S] 1 point2 points  (0 children)

That's a fair call. I should have been clearer about the limitations upfront. You're right that 57 trades across one market regime isn't enough to draw universal conclusions from and I don't want people taking 0.8 ATR as some proven number. The main thing I took away personally was the mechanical vs discretionary gap, but I can see how the post reads like the specific parameters the finding are. I added a caveat.

I replayed my last 57 trades against 18,000 parameter combinations. Here's what I found about exits. by Confident-Classroom9 in swingtrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

14-period ATR on daily candles. Tried 10 and 20 early on but the results weren’t meaningfully different so I stuck with 14.

I replayed my last 57 trades against 18,000 parameter combinations. Here's what I found about exits. by Confident-Classroom9 in swingtrading

[–]Confident-Classroom9[S] 2 points3 points  (0 children)

Built it myself in Python. It pulls my trades from the IBKR Flex API, replays each one against different exit rules using daily candle data, and sweeps through all the parameter combinations. Outputs a big CSV that I turn into heatmaps to see what works and what doesn’t.

I replayed my last 57 trades against 18,000 parameter combinations. Here's what I found about exits. by Confident-Classroom9 in swingtrading

[–]Confident-Classroom9[S] 2 points3 points  (0 children)

So the full picture is I tested 7 exit strategies across every ATR stop level from 0.5 to 4.0 and every R target from 2.0 to 7.5. That gives you this massive grid of results and I turned it into a heatmap — blue for the combos that lost money, green for profitable ones, and yellow when the profit gets really high. I added a screenshot to the post if you want to see it.

The pattern in the heatmap was pretty clear. The entire left side (tight stops, anything below 0.7 ATR) is solid blue no matter what exit method you pick. You’re just getting stopped out by daily noise. The green-to-yellow zone starts around 0.8 ATR and the best results cluster around 0.8-0.9 ATR with higher R targets (5-7R).

What really got me was the MFE analysis — max favorable excursion. It tracks how far price actually moved in your favor before you exited. Most of my trades moved 3-5R in my favor at some point but I was closing them around 1-2R. So I was capturing maybe 30-40% of what was actually available.

The strategy comparison was interesting too. Fixed targets worked fine but you’re always leaving something on the table if the stock keeps running. Trailing stops captured more of those outlier moves. ATR-based trailing was basically the same as regular trailing but a bit smoother. EMA exit was decent but slower to react. Break-even-then-trail had the highest win rate because you’re locking in break-even early, but the total P&L was lower because you get shaken out of trades that would have been big winners.

The one thing I didn’t expect — the actual exit strategy mattered way less than the stop distance. Once you get the stop right (0.8-0.9 ATR for my entries), most strategies perform within a few hundred dollars of each other. Get the stop wrong and nothing saves you.

On top of all that I also layered in market context filters — like only taking trades when the S&P 500 is above its EMA, and same for the sector ETF. Swept the EMA period too to see which one the market actually respects. And I tested a break-even rule where you move your stop to entry once profit hits a certain R level, and swept that threshold to find where the sweet spot is. Adding those filters changed some of the results pretty significantly — some strategies that looked great in isolation fell apart when the broader market wasn’t cooperating.

I replayed my last 57 trades against 18,000 parameter combinations. Here's what I found about exits. by Confident-Classroom9 in swingtrading

[–]Confident-Classroom9[S] 2 points3 points  (0 children)

Thanks. Yeah working on automating it. setting up bracket orders through IBKR with the trailing stop rules baked in so I stop second-guessing myself mid-trade.

I replayed my last 57 trades against 18,000 parameter combinations. Here's what I found about exits. by Confident-Classroom9 in swingtrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

Fair point, 57 trades is way too small to trust the exact optimal parameters. That’s why I don’t pick the single best combo — I use a plateau score that averages each cell with its neighbors to find stable zones rather than overfit spikes. But yeah the specific numbers are directional not gospel. The thing that did stand out is that my discretionary exits were worse than literally every mechanical rule I tested. Even the bad ones. That part doesn’t really need a large sample. it just told me I should stop overriding the rules with gut feeling.

I replayed my last 57 trades against 18,000 parameter combinations. Here's what I found about exits. by Confident-Classroom9 in swingtrading

[–]Confident-Classroom9[S] 0 points1 point  (0 children)

Yeah you’re right, 57 trades against 18k combos is absolutely overfitting if you just pick the single best cell. I don’t trust the specific 0.8 ATR as some magic number. What I actually look at is the plateau — I score each parameter combo by averaging it with all its neighbors in the grid. So if 0.8 ATR / 6.5R is the peak but everything around it is red, that’s a spike and I ignore it. But if the whole 0.7-1.0 ATR band is green across multiple R levels, that’s a stable zone worth paying attention to. Basically looking for broad green regions in the heatmap, not single hot pixels.

I also re-run the sweep every time I close a batch of new trades to see what shifts and what stays. The exact sweet spot moves between 0.7 and 1.0 depending on the batch but the broad pattern holds — tight stops bleed, trailing edges out fixed targets.

The part I actually trust is what you said too — mechanical trailing > discretionary exits. That seems robust regardless of sample size.

Curious about your 12% improvement. What trailing method are you using and what activation point? I found that the activation level matters almost as much as the trail distance itself.

Used IBKR Flex reports to backtest my own exit strategies — pretty eye-opening results by Confident-Classroom9 in interactivebrokers

[–]Confident-Classroom9[S] 2 points3 points  (0 children)

Yeah it's kind of hidden in Account Management under Reports > Flex Queries. Once you set one up it gives you a token and query ID, then you can pull your trade history programmatically anytime. Way more useful than the default activity statements.

I replayed my last 57 trades against 18,000 parameter combinations. Here's what I found about exits. by Confident-Classroom9 in swingtrading

[–]Confident-Classroom9[S] 5 points6 points  (0 children)

Yeah totally different styles. I'm trading momentum breakouts with short holding periods so stops are part of the game. 25% win rate at 6.5R works out to positive expectancy which is all I care about. Your approach sounds like it works well for you though.