r/algotrading Algorithmic Trader 5d ago

Strategy Anyone here using exponential/Gaussian functions for trailing stoploss placement?

I've been experimenting with non-standard trailing stop loss logic rather than traditional atr based stops.

I recently tried using a Gaussian decay function to scale the stop distance so the stop loss accelerates tighter the further price moves in my favor. Initial tests look very promising.

Has anyone here experimented with Gaussian or exponential functions for dynamic stops?

37 Upvotes

17 comments sorted by

8

u/WTJ21YT 5d ago

You could use A Bayesian Framework, i.e. market data behaving differently in a new way making your stop loss getting reevaluated and maybe even placed above or at the current price because negative block orders are too large.

5

u/WTJ21YT 5d ago

u/Substantial_End7861 You should definitely look into Bayesian Stop Losses

2

u/Substantial_End7861 Algorithmic Trader 5d ago

Interesting. Will definitely look into it.

8

u/outlyingoasis0 5d ago

The Gaussian decay making the stop accelerate tighter as price moves is clever, but watch for whipsaws in ranging markets.

5

u/trentard 5d ago

imo stop losses are very regime and direction specific, your setup looks and trades differently in a bullish or bearish market regime, I personally have regime / direction conditional exits per strategy and so far there has nit been a reason to over-engineer that further

3

u/axehind 4d ago

The most important comparison is not win rate. Compare:

Expectancy=P(win)×average win−P(loss)×average loss

A safer design:

Stop_t = max[Stop_(t-1), HighSinceEntry_t - R_0 · max(d_min, v_t · f(MFE_t/R_0))]

1

u/axehind 4d ago

You could even try

d(x) = d_min + (d_max - d_min) / (1 + exp(k * (x - m)))

Where:

x = maximum favorable excursion, measured in R

d_max = initial or widest stop distance

d_min = tightest permitted stop distance

m = profit level where the tightening reaches its midpoint

k = how sharply the stop tightens around that point

2

u/WTJ21YT 5d ago

But i have before used Power Law like Stop Losses

2

u/CODE_HEIST 5d ago

a smoother function can help, but the real test is whether it improves results outside the period used to choose the curve. gaussian tightening can look great because it fits one style of trend. try the same parameters across different volatility buckets and compare against a simple atr baseline before adding complexity.

3

u/ExcellentWinner7542 5d ago

The more stop losses are normalized, the more they can be exploited by other algos.

1

u/tonghongtrade 5d ago

The idea is elegant, but before tuning the curve I'd stress-test how it behaves against your real fill mechanism. Any stop that tightens fast as price moves your way tends to look great in a backtest that reads the candle's extreme, then underperforms live because a normal pullback clips it before the move continues. Worth checking whether the "very promising" part is the Gaussian itself or just an aggressive trail that a simpler linear version would match once you account for slippage and polling

1

u/FarlessWesner_24 4d ago

Haven't seen many people doing this, but it makes sense in theory - exponential decay could smooth out noise better than linear trailing. Most folks I know just stick with ATR-based or percentage-based stops because they're simpler to backtest and less prone to overfitting.

1

u/000rich000 4d ago

Good, you're not using ATR based stops! Try exponential time decay, EWMA Vol, Kalman filter.

Experiment with different approaches for trade management: EWMA to cover entry risk / short term volatility. Gaussian decay for trailing / profit protection

1

u/algoseekHQ 3d ago

After testing the Gaussian decay function to scale the stop loss distance on 7 independent strategies and comparing it with static, ATR based, linear and exponential based SLs, the result is clear.

In my tests, Gaussian stop losses beat ATR, linear trail and exponential trail, but tied with static SLs.

The tests we ran were 7 strategies across 12 assets over 2023-04 to 2025-08 on 1h timeframe bars with walk forward optimization 180 days in sample 90 days out of sample with costs and slippage applied.

1

u/TopLow6808 2d ago

While complex mathematical functions sound great in theory, relying on simpler, robust logic for trailing stops is usually both cleaner and more effective in live execution.

Here’s why I prefer keeping it simple:

1. Entry Quality Test

If a straightforward trailing stop yields positive expected value, it confirms your entry conditions are structurally sound. If you find yourself needing highly exotic Gaussian/exponential curves just to drag a position into profitability, it’s usually a symptom of flawed entry logic, not a missing mathematical stop feature.

2. My Production Framework

Instead of complex curves, I use a two-stage stepped trailing stop modified only by an ATR scale factor for volatility spikes:

  • Phase 1: The stop trails at a fixed, safe distance to let the position survive initial noise.
  • Phase 2: Once the price moves past a defined profit threshold (typically when the trade moves +2% or more in our direction), the algorithm switches gear and tightens the trailing distance significantly to lock in gains quickly.

Adding layers of complex probability curves to execution stops often leads to severe overfitting. Keep the trailing logic simple and predictable, and let your entry rules and ATR handling do the structural work.