Auto-discovered strategy
Symbol: BTC | Exchange: Bitfinex | Role: defensive
Click a year to view chart
| Year | Return | Win Rate | Trades | Max DD | Sharpe |
|---|---|---|---|---|---|
| 2020 | +9.0% | 33.3% | 12 | 8.6% | 0.67 |
| 2021 | +19.5% | 37.5% | 24 | 8.0% | 1.04 |
| 2022 | +21.6% | 41.7% | 36 | 11.1% | 1.01 |
| 2023 | +12.4% | 60.0% | 10 | 3.0% | 1.25 |
| 2024 | +10.0% | 41.7% | 12 | 5.8% | 0.73 |
| 2025 | +8.3% | 40.9% | 22 | 4.7% | 0.69 |
| Window | Train Period | Val Period | Val Return | Val | Test Period | Test Return | Status |
|---|---|---|---|---|---|---|---|
| WF-1 | 2024-01→2025-06 | 2025-07→2025-12 | +3.0% | OK | 2026-01→ongoing | +0.0% | PASS |
Not yet reviewed. Run: ./review_strategy.sh bear_breakdown_short
"""
Bear Breakdown Short Strategy
=============================
SHORT-only strategy for bear markets that profits from support breakdowns.
Principle:
- In bear markets (EMA50 < EMA200), price tends to break support levels
- High-volume breakdowns signal continuation of the downtrend
- Consecutive red bars confirm selling momentum
Entry Conditions:
1. Bear regime: EMA50 < EMA200
2. Price below EMA50 (confirmed downtrend)
3. Breaking 25-bar swing low support
4. Volume > 1.3x 20-bar average (breakdown conviction)
5. Three consecutive red bars (momentum)
Exit Conditions:
1. Price reclaims EMA50 (trend change)
2. Bull regime starts (EMA50 > EMA200)
3. Two consecutive green bars (momentum reversal)
4. Stop loss: 3.5%
5. Take profit: 7.0%
Risk Management:
- Only trades in bear markets (regime filter)
- Tight 3.5% stop loss
- 2:1 reward-to-risk ratio
- Volume confirmation reduces false breakdowns
Train Performance (2024-01 to 2025-06):
2024: +10.0% | 12 trades | 42% WR
2025: +5.2% | 9 trades | 56% WR
Total: +15.2% | Max DD: 5.8%
"""
import sys
sys.path.insert(0, '/root/trade_rules')
from lib import ema, lowest
def init_strategy():
return {
'name': 'bear_breakdown_short',
'role': 'defensive',
'warmup': 200, # EMA200
'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']
# warmup=200 ensures we have enough bars for EMA200
closes = [b.close for b in bars]
lows = [b.low for b in bars]
volumes = [b.volume for b in bars]
# Calculate EMAs for regime detection
ema50_vals = ema(closes, 50)
ema200_vals = ema(closes, 200)
ema_50 = ema50_vals[i]
ema_200 = ema200_vals[i]
if ema_50 is None or ema_200 is None:
return []
current_price = closes[i]
current_low = lows[i]
# REGIME: Bear market (EMA50 < EMA200)
is_bear_regime = ema_50 < ema_200
# ENTRY SIGNAL: Support breakdown
swing_low = lowest(lows, 25, i) # 25-bar swing low as support
if swing_low is None:
return []
# Breakdown: current low breaks below support with margin
breakdown = current_low < swing_low * 0.995
# VOLUME CONFIRMATION: Above-average volume
avg_volume = sum(volumes[i-20:i]) / 20
high_volume = volumes[i] > avg_volume * 1.3
# TREND CONFIRMATION: Price below EMA50
below_ema50 = current_price < ema_50
# MOMENTUM CONFIRMATION: Consecutive red bars
red_bars = closes[i] < closes[i-1] < closes[i-2]
actions = []
if key not in positions:
# SHORT ENTRY:
# All conditions must be met
if is_bear_regime and below_ema50 and breakdown and high_volume and red_bars:
actions.append({
'action': 'open_short',
'symbol': 'tBTCUSD',
'exchange': 'bitfinex',
'size': 1.0,
'stop_loss_pct': 3.5, # Tight stop
'take_profit_pct': 7.0, # 2:1 R/R
})
else:
pos = positions[key]
if pos.side == 'short':
# SHORT EXIT:
above_ema50 = current_price > ema_50
bull_regime = ema_50 > ema_200
green_bars = closes[i] > closes[i-1] > closes[i-2]
if above_ema50 or bull_regime or green_bars:
actions.append({
'action': 'close_short',
'symbol': 'tBTCUSD',
'exchange': 'bitfinex',
})
return actions