This script identifies bullish/bearish market regimes for Bitcoin using a hybrid strategy combining price action, on-chain data, and multi-timeframe confirmations. It avoids simple "indicator mashups" by enforcing strict logical gates between 6 independent systems. Below is the breakdown:
Core Components & Bull/Bear Conditions
1. Trend Foundation: Parabolic SAR & EMA Ribbon
SAR (5D/1W): Dynamic stop-loss levels. A bullish flip occurs when SAR moves below price; a bearish flip when above.
EMA Ribbon: 50-day (short-term) vs. 200-day (long-term) EMAs across 4H/D timeframes.
Golden Cross (Bull): 50EMA > 200EMA on both 4H and daily charts.
Death Cross (Bear): 50EMA < 200EMA on both timeframes.
2. Momentum Filters: ADX + RSI
ADX (14-period): Filters trades to strong trends (ADX > 20 + rising).
Bull: +DI > -DI and rising.
Bear: -DI > +DI and rising.
RSI (14-period): Custom thresholds for Bitcoin’s volatility:
Bull: RSI > 56 (overbought breakout in uptrends).
Bear: RSI < 44 (oversold breakdown in downtrends).
3. Cycle Timing: Pi Cycle Top/Bottom
Pi Bottom (Bull): 150-day EMA crosses under 471-day SMA (historical accumulation zones).
Pi Top (Bear): 350-day SMA crosses under 111-day SMA (macro distribution signals).
Blocks trades if a Pi Top signal occurred in the past 60 days (avoids false bulls during macro downtrends).
4. Miner Sentiment: Hash Ribbon
Capitulation Phase (Bear): 30-day Hash Rate SMA < 60-day SMA.
Recovery Phase (Bull): 30-day SMA > 60-day SMA + 10-day price SMA > 20-day SMA.
Required for bear exits: Recent capitulation within 60 days.
5. Volatility Normalization: Fisher Transform
Bullish Setup: Fisher Value (fish1) < 1.92 (price not overextended).
Bearish Setup: Fisher Value > -1.89 (price not oversold).
6. Multi-Timeframe SAR Confirmation
5D SAR must align with 1W SAR (e.g., both below price for bulls).