← Back to list

tail_risk_bounce_hedge VALIDATED FAIL

Auto-discovered strategy

Symbol: BTC | Exchange: Bitfinex | Role: hedge

2/6
Profitable Years
-56.7%
Total Return
48.8%
Avg Win Rate
-0.93
Avg Sharpe

Year-by-Year Results

Click a year to view chart

Year Return Win Rate Trades Max DD Sharpe
2020 -22.0% 50.0% 10 23.1% -1.83
2021 -4.9% 67.4% 46 22.5% -0.16
2022 -35.2% 47.6% 21 31.4% -1.69
2023 -1.4% 0.0% 3 1.4% -2.66
2024 +5.1% 77.8% 9 8.0% 0.48
2025 +1.7% 50.0% 8 2.6% 0.30

Performance Chart

Loading chart...

Walk-Forward Validation FAIL

0/1 Windows Profitable
-1.3% OOS Return
0.00 Median Sharpe
0.000 Score
Window Train Period Val Period Val Return Val Test Period Test Return Status
WF-1 2024-01→2025-06 2025-07→2025-12 -1.3% FAIL 2026-01→ongoing +0.0% FAIL

AI Review

Not yet reviewed. Run: ./review_strategy.sh tail_risk_bounce_hedge

Source Code

"""
Strategy: tail_risk_bounce_hedge
=================================
Tail risk hedge strategy with put-like payoff.

Profits from crash bounce events rather than shorting crashes.
Provides asymmetric returns: flat in normal markets, profits during/after crashes.

Role: hedge (must profit in validation, Sharpe >= 0.3)

Train Performance (2024-2025H1):
  2024: +5.1% | 9 trades | 78% WR
  2025: +3.0% | 4 trades | 50% WR
  Total: +8.1% | Max DD: 8.0% | Sharpe: 0.74

Logic:
  Entry: Crash bounce setup
  - Drop > 8% from 20-bar high (crash detected)
  - Bar range > 2% (high volatility)
  - Lower wick > 40% of range (exhaustion candle)
  - Volume > 1.5x 20-bar average (climax selling)

  Exit: Quick profit capture
  - Take profit: +10%
  - Stop loss: -8%
  - Time exit: 5 bars
  - Or 2 consecutive green candles
"""
import sys
sys.path.insert(0, '/root/trade_rules')
from lib import ema, atr


def init_strategy():
    return {
        'name': 'tail_risk_bounce_hedge',
        'role': 'hedge',
        'warmup': 50,
        'role': 'hedge',
        'subscriptions': [
            {'symbol': 'tBTCUSD', 'exchange': 'bitfinex', 'timeframe': '4h'},
        ],
        'parameters': {}
    }


def process_time_step(ctx):
    """
    Tail Risk Bounce Hedge - Crash Recovery Strategy
    =================================================

    Put-like protection via crash bounce trading:

    Entry (ALL required):
    1. Drop > 8% from 20-bar high (crash)
    2. Bar range > 2% (high volatility)
    3. Lower wick > 40% (exhaustion)
    4. Volume > 1.5x average (climax)

    Exit:
    - TP: +10%
    - SL: -8%
    - Time: 5 bars
    - Or 2 green candles
    """
    key = ('tBTCUSD', 'bitfinex')
    bars = ctx['bars'].get(key, [])
    i = ctx['i']
    positions = ctx['positions']

    if not bars or i >= len(bars) or i < 50:
        return []

    closes = [b.close for b in bars]
    highs = [b.high for b in bars]
    lows = [b.low for b in bars]
    volumes = [b.volume for b in bars]
    opens = [b.open for b in bars]

    atr_vals = atr(highs, lows, closes, 20)
    if atr_vals[i] is None:
        return []

    # === CRASH DETECTION ===
    # Drop from 20-bar high > 8%
    recent_high = max(highs[i-20:i])
    drop_pct = (recent_high - closes[i]) / recent_high * 100
    in_crash = drop_pct > 8

    # High volatility: bar range > 2%
    bar_range = highs[i] - lows[i]
    bar_range_pct = bar_range / closes[i] * 100
    high_vol = bar_range_pct > 2

    # === EXHAUSTION DETECTION ===
    # Lower wick > 40% of range
    lower_wick = min(closes[i], opens[i]) - lows[i]
    wick_ratio = lower_wick / bar_range if bar_range > 0 else 0
    exhaustion = wick_ratio > 0.4

    # Volume climax: > 1.5x average
    avg_vol = sum(volumes[i-20:i]) / 20
    vol_climax = volumes[i] > avg_vol * 1.5

    actions = []
    has_position = key in positions

    if not has_position:
        # All conditions must be met
        crash_bounce = in_crash and high_vol and exhaustion and vol_climax

        if crash_bounce:
            actions.append({
                'action': 'open_long',
                'symbol': 'tBTCUSD',
                'exchange': 'bitfinex',
                'size': 1.0,
                'stop_loss_pct': 8,
                'take_profit_pct': 10,
            })
    else:
        pos = positions[key]
        if pos.side != 'long':
            return []

        bars_held = i - pos.entry_bar

        # Count green candles in last 2 bars
        green_count = sum(1 for j in range(max(0, i-1), i+1) if closes[j] > opens[j])

        # Exit on time or momentum
        if bars_held >= 5 or green_count >= 2:
            actions.append({
                'action': 'close_long',
                'symbol': 'tBTCUSD',
                'exchange': 'bitfinex',
            })

    return actions