Momentum that arrives with real participation tends to travel farther. This composite model aligns four simple conditions before committing capital: trend context (price vs. MA), directional thrust (lookback momentum), participation (volume vs. its mean), and a momentum health check (RSI within non-extreme bounds). Positions are managed by ratcheting trailing stops that only move in the trade’s favor.
def next(self):
= self.data.close[0]
px
# Manage existing positions with ratcheting trailing stops
if self.position.size > 0: # long
if self.highest_price is None or px > self.highest_price:
self.highest_price = px
self.trailing_stop_long = px * (1 - self.p.trailing_percent / 100)
if px <= self.trailing_stop_long:
self.close()
self.highest_price = None
self.trailing_stop_long = None
elif self.position.size < 0: # short
if self.lowest_price is None or px < self.lowest_price:
self.lowest_price = px
self.trailing_stop_short = px * (1 + self.p.trailing_percent / 100)
if px >= self.trailing_stop_short:
self.close()
self.lowest_price = None
self.trailing_stop_short = None
# New entries only when flat
if self.position.size == 0:
= px > self.price_ma[0]
price_above_ma = px < self.price_ma[0]
price_below_ma = self.volume_ratio[0] > self.p.volume_threshold
strong_volume = self.price_momentum[0] > self.p.momentum_threshold
pos_mom = self.price_momentum[0] < -self.p.momentum_threshold
neg_mom = self.rsi[0] > self.p.rsi_oversold and self.rsi[0] < self.p.rsi_overbought
rsi_ok_long = self.rsi[0] < self.p.rsi_overbought and self.rsi[0] > self.p.rsi_oversold
rsi_ok_short
# Long: trend up + positive thrust + real participation + RSI not stretched
if price_above_ma and pos_mom and strong_volume and rsi_ok_long:
self.buy()
self.highest_price = px
self.trailing_stop_long = px * (1 - self.p.trailing_percent / 100)
# Short: trend down + negative thrust + real participation + RSI not stretched
elif price_below_ma and neg_mom and strong_volume and rsi_ok_short:
self.sell()
self.lowest_price = px
self.trailing_stop_short = px * (1 + self.p.trailing_percent / 100)
Trend alignment filters counter-trend fades.
Momentum is measured as directional return over a fixed window, not just a moving average cross.
Volume ratio enforces participation, reducing low-liquidity fakes.
RSI keeps entries out of exhaustion pockets.
Trailing stops convert volatility into exit discipline without arbitrary targets.
Raise volume_threshold
to demand stronger
participation in choppy assets.
Widen momentum_threshold
to filter noise; tighten
for responsiveness.
Adjust trailing_percent
to balance staying power
versus giveback.
Consider ATR-based trailing for regime-adaptive exits.
Explosive upside potential — Average window return over +109%, but with huge variability (std. dev. ~148%).
Median return of +20% suggests most years saw modest gains, with a few extraordinary outliers pushing the mean higher.
Best window delivered +339.7%, showcasing the strategy’s ability to capture major momentum surges.
Worst window only –9.6%, with max drawdown surprisingly shallow for such aggressive gains.
Sharpe Ratios in the 0.73–0.86 range show decent return per unit risk, especially given crypto volatility.
Win rate exactly 50%, meaning half the windows were positive — but the wins were much larger than the losses.
Total backtest return: +1853%, turning $100K into over $1.95M over the test period.
This reads as a high-volatility, asymmetric payoff profile — the losers are small, but the winners are massive. The key challenge would be enduring sideways or flat years without giving back gains.
If you want, I can now write this as part of a full article with the strategy logic snippet, similar to your last request.