Auto-discovered strategy
Symbol: BTC | Exchange: Bitfinex | Role: momentum
Click a year to view chart
| Year | Return | Win Rate | Trades | Max DD | Sharpe |
|---|---|---|---|---|---|
| 2020 | +70.5% | 50.0% | 28 | 20.4% | 2.01 |
| 2021 | -5.5% | 26.9% | 26 | 25.2% | -0.21 |
| 2022 | -2.9% | 28.6% | 7 | 8.8% | -0.25 |
| 2023 | -18.4% | 25.0% | 20 | 24.9% | -0.95 |
| 2024 | +36.9% | 37.5% | 24 | 16.6% | 1.56 |
| 2025 | +2.2% | 31.2% | 16 | 12.3% | 0.14 |
| Window | Train Period | Val Period | Val Return | Val | Test Period | Test Return | Status |
|---|---|---|---|---|---|---|---|
| WF-1 | 2024-01→2025-06 | 2025-07→2025-12 | -3.4% | FAIL | 2026-01→ongoing | +0.0% | FAIL |
Not yet reviewed. Run: ./review_strategy.sh regime_guarded_momentum_breakout
"""
Strategy: regime_guarded_momentum_breakout
==========================================
Regime-Guarded Momentum Breakout Strategy
A cash-out-of-market strategy that stays 100% in cash during bear regimes
and only enters long positions when momentum is confirmed in bull trends.
Core Principles:
================
1. STRICT BEAR FILTER: Stay 100% flat when ANY bear signal appears
- EMA cascade must be intact (EMA20 > EMA50 > EMA200)
- Price must be above EMA200
- EMA200 must be rising (20-bar slope check)
2. VOLUME-CONFIRMED BREAKOUTS: Only enter when:
- Price breaks above 8-bar high (momentum confirmation)
- Volume is 15%+ above 20-bar average (participation confirmation)
- Price not overextended (< 12% above EMA50)
3. QUICK EXIT ON WEAKNESS:
- Exit immediately on ANY bear regime signal
- Exit if price drops below EMA50
- Hard stop at 4%, take profit at 10%
Universal Market Principles:
===========================
- Trend following via EMA alignment
- Momentum via price breakouts
- Volume confirmation for entry validity
- Capital preservation in bear markets
Why This Works in Bear Markets:
==============================
- Triple confirmation for bull regime means we're flat most of the time
during corrections and bear trends
- Volume filter prevents false breakout entries on low conviction moves
- Quick exits preserve capital when regime weakens
Performance (TRAIN: 2024-01-01 to 2025-06-30):
=============================================
2024: +36.9% | 24 trades | 38% WR | Sharpe 1.56 | Max DD 16.6%
2025-H1: +5.2% | 7 trades | 43% WR | Sharpe 0.50 | Max DD 5.3%
Total: +42.1% | 2/2 train periods profitable
"""
import sys
sys.path.insert(0, '/root/trade_rules')
from lib import ema
def init_strategy():
return {
'name': 'regime_guarded_momentum_breakout',
'role': 'momentum',
'warmup': 210,
'subscriptions': [
{'symbol': 'tBTCUSD', 'exchange': 'bitfinex', 'timeframe': '4h'},
],
'parameters': {}
}
def process_time_step(ctx):
key = ('tBTCUSD', 'bitfinex')
bars = ctx['bars'][key]
i = ctx['i']
positions = ctx['positions']
# Need enough bars for EMA200 + lookback
if i < 210:
return []
closes = [b.close for b in bars]
highs = [b.high for b in bars]
volumes = [b.volume for b in bars]
# Core EMAs for regime detection
ema20 = ema(closes, 20)
ema50 = ema(closes, 50)
ema200 = ema(closes, 200)
# Ensure indicators are valid
if ema20[i] is None or ema50[i] is None or ema200[i] is None:
return []
# =========================================================
# STRICT REGIME DETECTION
# Must pass ALL checks to be in bull regime:
# =========================================================
# 1. EMA Cascade: 20 > 50 > 200 (proper uptrend structure)
ema_cascade = ema20[i] > ema50[i] > ema200[i]
# 2. Price above EMA200 (confirms major uptrend)
price_above_200 = bars[i].close > ema200[i]
# 3. EMA200 rising over 20 bars (long-term trend healthy)
ema200_rising = ema200[i] > ema200[i-20] if ema200[i-20] else False
# Combined bull regime check
bull_regime = ema_cascade and price_above_200 and ema200_rising
# =========================================================
# VOLUME CONFIRMATION
# Must be above 20-bar average + 15%
# =========================================================
vol_avg_20 = sum(volumes[i-20:i]) / 20
vol_strong = volumes[i] > vol_avg_20 * 1.15
actions = []
if key not in positions:
# =========================================================
# ENTRY: Bull regime + volume-confirmed breakout
# =========================================================
if bull_regime:
# Price breaks above 8-bar high (momentum confirmation)
breakout = bars[i].close > max(highs[i-8:i])
# Not overextended from EMA50 (max 12% above)
not_extended = bars[i].close < ema50[i] * 1.12
# Entry signal: all conditions must be true
if breakout and vol_strong and not_extended:
actions.append({
'action': 'open_long',
'symbol': 'tBTCUSD',
'exchange': 'bitfinex',
'size': 1.0,
'stop_loss_pct': 4.0, # 4% hard stop
'take_profit_pct': 10.0 # 10% take profit (2.5:1 R:R)
})
else:
# =========================================================
# EXIT: Protect capital on ANY weakness signal
# =========================================================
# 1. Exit immediately on bear regime
if not bull_regime:
actions.append({
'action': 'close_long',
'symbol': 'tBTCUSD',
'exchange': 'bitfinex',
})
# 2. Exit if price drops below EMA50 (medium-term support broken)
elif bars[i].close < ema50[i]:
actions.append({
'action': 'close_long',
'symbol': 'tBTCUSD',
'exchange': 'bitfinex',
})
return actions
# Entry/Exit logic descriptions for documentation
ENTRY_LOGIC = """
BEAR FILTER (must pass ALL):
- EMA20 > EMA50 > EMA200 (EMA cascade intact)
- Price > EMA200 (above long-term trend)
- EMA200 rising over 20 bars (uptrend confirmed)
ENTRY SIGNAL (all required):
- Price breaks above 8-bar high (breakout)
- Volume > 115% of 20-bar average (confirmation)
- Price < 112% of EMA50 (not overextended)
"""
EXIT_LOGIC = """
EXIT when ANY:
- Bear regime detected (EMA cascade breaks OR price < EMA200 OR EMA200 falling)
- Price closes below EMA50
- Stop loss hit (4%)
- Take profit hit (10%)
"""