r/algotrading • • 3d ago

Strategy Question for the sub

on range-based strategies, do you use a minimum stop distance, say a fraction of ATR? And if you'd only add it after seeing a tiny-range day like Thanksgiving, how do you stop it becoming a curve fit?

6 Upvotes

23 comments sorted by

2

u/drguid 2d ago

Time based stops. I couldn't get price based stops to improve returns. In most cases they reduce returns.

2

u/blu_mOOn_2020 2d ago

Hmm time based, isn't that open you up to unknown stoploss risks??

1

u/AlgonikHQ 2d ago

That's the trade-off. On my side the price stop stays as the worst case and the clock does most of the exiting, so the risk is capped, but most trades end on time rather than at the stop.

1

u/AlgonikHQ 2d ago

That matches what I've seen. This breakout already exits on the clock at the close, and the price stop is mainly there as protection. What surprised me was how much the stop's size, rather than whether it's hit, drives position size when the stop sets the sizing.

2

u/AureusAI 2d ago

I'd add it, but base it on the logic, not on Thanksgiving. A range that's a fraction of normal is basically a different market: thin liquidity, and the spread eats the stop. To keep it honest, pick the floor before you look at results (something like 0.3–0.5x the 20-day ATR), then rerun the backtest at a few nearby values. If the result barely moves, it's a safety rail. If only one exact value makes it work, you're fitting to a handful of days. Also worth counting how many trades the rule actually touches. If it's 5 trades in 3 years, it isn't changing your edge either way.

1

u/AlgonikHQ 2d ago

Agreed. The floor gets picked before I look, then tested at a few nearby values, and I'll count how many trades it actually touches. If it's a handful over five years, it's a safety rail, not part of the edge, and I'll call it that.

2

u/marekesz1 2d ago

Yeah, I floor it at a fraction of ATR picked before I looked at holiday sessions. Then check out of sample whether tiny-range days lose money across several years. If the floor only rescues Thanksgiving, you're fitting.

1

u/AlgonikHQ 2d ago

That's the honest version, pick the fraction first, then check tiny-range days across several years, not one session. If it only rescues Thanksgiving, it's a fit.

1

u/AlgonikHQ 2d ago

Update.

I ran the test you all helped shape, so here's how it came out.

Setup. the floor was fixed before running, based on volatility and costs, all known before entry.
I tested two versions against the original, widen the stop with size cut so risk stays the same, or skip the trade.
Same run at a tighter and a looser floor value. Design years only (2015–19), later data stays sealed.

Results, over 6,736 trades,

  • The floor touched about 1.2% of trades, and every one was in the smallest opening-range group. Mid-range days didn't change at all, so it isn't quietly reshaping the whole strategy.
  • Widening barely moved anything (about +0.001R a trade).
  • Skipping helped slightly (about +0.004R a trade). The skipped trades averaged −0.35R against −0.07R for the ones kept, which looks big, but it's only 82 trades and came out at 1.8 standard errors, short of the 2 I set beforehand.

Verdict, a safety rail, not an edge. It removes a few bad tiny-range days and does no measurable harm, but the breakout still loses overall, so it doesn't revive anything.
It's logged as try 77 in the graveyard.

Thanks to everyone who weighed in.

1

u/djawlagml 2d ago edited 2d ago

Yes, but I'd try to derive the floor from something that isn't the data you're afraid of fitting. The useful decomposition is: minimum distance = the price distance at which the trade idea is already dead, plus the round-trip cost expressed in price. The cost part is a constraint rather than a parameter, and it's the part range strategies usually forget, because a compressed range squeezes the target as well as the stop, so the ratio degrades from the cost side before the stop is ever touched. If the floor is max(k x ATR, 2-3x round-trip cost, spread at the entry hour), then "ATR fraction" is the only free knob left and it's bounded from below by mechanics. The other half of the question is really about the shape of the change. A rule that only earns its keep on one observed day is a fit to that day no matter how you write it down; a rule that expresses the mechanism (range compression means the same price noise is a larger fraction of the range, so the stop must widen relative to the range, not shrink with it) can still be wrong but is at least falsifiable. The cheap test is a placebo: freeze the rule, then apply the identical rule across the sample sorted by daily range and look at how often it changes the outcome. If it also helps on mid-range days, the relationship is plausibly real. If it only helps in the low-range tail, the honest label is "this is the observation, not the signal", and the pre-registered expectation should be neutral everywhere else. One structural alternative that avoids the new parameter entirely: make the stop a continuous function of realized range (c times the max range of the last N bars), calibrate c before you look at the day that bothered you, and let that day be a test instead of an input. Time stops are worth trying for the same reason the other reply gives; on range entries the state that produced the signal expires on a clock, not at a price, so a time exit usually damages the rest of the grid far less than a price stop does.

1

u/AlgonikHQ 2d ago

Really useful framing, thanks you. Treating costs as a hard constraint rather than something to tune makes sense, a stop that's only a couple of spreads wide isn't a real stop.

The placebo is what I'll actually run. Freeze the floor, apply it across the whole sample sorted by daily range, and see whether it changes mid-range days too, or only the tiny-range tail. If it's only the tail, it's just describing what happened, not a signal.

1

u/Impressive-Belt-6842 2d ago

the part worth testing first is whether atr is even measuring the thing you are afraid of. a 20 day atr barely moves on one compressed session, so the floor derived from it stays wide on exactly the days you want filtered out. a shorter window reacts on the timescale of the event: atr over 3 to 5 sessions, or just the range of the previous two. then judge it by what it blocks, not by the equity curve. record how many of the last year's trades the floor would have refused. three trades means decoration, twenty means a rule, and the only question that matters is whether the refused ones had worse net r than the kept ones.

1

u/AlgonikHQ 2d ago

Good point about ATR window length. It depends what the floor does, though. If it widens the stop, a slow 20-day ATR staying wide on a compressed day is actually what I want. If it skips the trade, you're right that a 3–5 session measure reacts on the right timescale. And judging it by what it refuses, with refused trades' R against kept trades', is a much cleaner test than the equity curve.

1

u/NiceJoJ 2d ago

I’d test three versions side by side: the original, one that widens the stop, and one that skips the trade when the original stop is too tight. Keep the planned dollar risk per trade the same by sizing down when you widen the stop. Then you can see whether those trades needed more room or were better skipped.

1

u/AlgonikHQ 2d ago

That's the design I'll use, the original, a widened stop with size cut so risk stays at £100, and a skip version, all side by side. That separates "needed more room" from "shouldn't have been traded".

1

u/DojiOwl 2d ago

I tie the stop to a volatility measure rather than a fixed tick distance, so on a compressed session the stop shrinks with the range instead of staying wide. The mechanical part that matters is computing that measure on a rolling window that excludes the current bar, otherwise the tiny-range day leaks into its own stop.

1

u/AlgonikHQ 2d ago

Agreed on keeping the current bar out. The ATR here is built only from completed prior days, so the day itself can't leak into its own stop. The problem is the other side, the range-based stop shrinks with the range, with no floor under it.

1

u/NJ_Algo 2d ago

I'd anchor it to something you'd have known in advance, not to that day. A stop tighter than spread plus normal slippage isn't a real stop anyway, so a floor based on costs or a small ATR fraction is easy to justify. Then check that the whole backtest barely changes across a few nearby values. If the improvement mostly comes from one Thanksgiving-type day, it's a fit.

2

u/AlgonikHQ 2d ago

That's where I've landed, a floor anchored to costs or a small ATR fraction, known in advance, then a check that the backtest barely moves across nearby values. If the improvement comes from one or two holiday-type days, I'll treat it as a fit.

1

u/GuiltyView3898 2d ago

Adding the stop rule only after seeing the Thanksgiving day is exactly how it turns into a curve fit, even if the rule itself makes sense. What works for me: write the rule down first, then judge it only on a period you haven't looked at yet. When I picked rules on one year and checked them on the next, hit rates of 60-92% in-sample dropped to 35-65%.

Also worth testing any exit against a plain fixed hold. I tried 60 score-based exits and none of them beat simply holding a fixed number of days.

1

u/Impressive-Belt-6842 1d ago

fair split, and it changes the test for the widen branch. if the floor only widens the stop, lag does not matter, but then the question becomes whether the extra distance is paid for: count the trades whose stop got moved and check whether their net r improved by more than the risk added per trade. if it improves by less, the floor is buying room with expectancy. the skip branch is the one where the window length matters, and there the check you described is the cheapest one available.

1

u/Maleficent-Success-6 1h ago

I'd test the minimum stop distance with fixed position sizes first, then repeat with risk-based sizing. Otherwise it's hard to tell whether the improvement comes from better exits or simply taking smaller positions on narrow-range days.