OPEN-SOURCE SCRIPT

HODL-V6-Full-Stack-L0+L1+L2

514
HODL V6 — Intelligent Dollar-Cost Averaging Strategy for Crypto
Overview
HODL V6 Smart DCA is a production-grade automated investment advisor built as a TradingView Pine Script (v6) indicator. It replaces mechanical "buy on the same day every month" DCA with a three-layer signal fusion system that dynamically adjusts position size based on macro conditions, trend regime, and asset-specific technicals.
The core insight: Not all dips are created equal. A -30% drawdown during a macro risk-off panic is fundamentally different from a -30% dip in a raging bull market. V6 quantifies this difference.
Three-Layer Architecture
┌─────────────┐
│ L0 MACRO │ 30% weight
│ DXY / Gold │ "Is now a good time
│ NDX / VIX │ to buy anything?"
│ Copper / Oil │
└──────┬───────┘
│
┌──────▼───────┐
│ L1 TREND │ 30% weight
│ EMA Regime │ "Which direction is
│ 30d Mom. │ THIS market going?"
│ Vol. Rank │
└──────┬───────┘
│
┌──────▼───────┐
│ L2 ASSET │ 40% weight
│ DCA Bands │ "How deep is THIS
│ RSI / EMA200│ specific dip?"
│ ATR / Regime │
└──────┬───────┘
│
┌──────▼───────┐
│ FINAL SCORE │ 0–100
│ → 5 Actions │ Dynamic sizing
└──────────────┘
L0 — Macro Layer (Global Risk Appetite)
Cross-asset data pulled from 6 macro instruments via request.security() on daily resolution to avoid lookahead bias:
Three sub-scores are computed:
Liquidity Score (weighted momentum of DXY/Gold/NDX/VIX)
Resonance Score (how many assets are aligned in a risk-on direction)
Fear & Greed Proxy (linear transform of VIX level, high VIX → fear)
L1 — Trend Layer (Crypto Market Regime)
Five-factor regime classification for the current asset:
EMA Triple Alignment (20 > 50 > 200) — structural trend health
ADX Filter (ADX > 25 distinguishes strong vs weak regimes)
30-Day Momentum — recent velocity
Volatility Percentile Rank — is the market unusually volatile?
Output: 5 distinct regimes: STRONG_BULL → WEAK_BULL → RANGE → WEAK_BEAR → STRONG_BEAR
L2 — Asset-Specific Layer (Entry Timing)
Five micro-indicators measuring "how good is this exact entry":
DCA Band Depth — distance from ATH mapped to 5 tiered zones (-20%, -30%, -40%, -50%, -65%)
RSI Zone Scoring — granular 10-zone RSI mapping (RSI < 20 = max score, RSI > 80 = 0)
Regime Edge — regime context modifies L2 score (bearish regime = larger L2 bonus when dip buys)
EMA200 Distance — how far below/above the 200-day EMA
ATR Volatility — higher volatility = larger score (chance to buy lower)
Overheat Penalty — RSI > 75 AND price > 20% above EMA200 = automatic -15 penalty
Decision Engine
Final score is a weighted blend:
Final Score = 0.30 × L0 + 0.30 × L1 + 0.40 × L2
The L2 layer gets the highest weight because entry timing matters most for DCA — the macro layer acts as a permission slip, not the primary signal.
Five Action Tiers
The gap between a Heavy Buy (×2.5) and Pause (×0) is a 5× capital efficiency swing — deploying capital when the model is confident, preserving it when conditions are hostile.
Key Design Decisions
Daily-resolution macro data with lookahead=barmerge.lookahead_on — prevents future leak from cross-market timezone differences
ATH-based DCA reference instead of fixed calendar schedule — adapts to market structure; deeper drawdowns get higher scores
Asymmetric risk management — the model is more aggressive at scaling IN than scaling OUT. In bull regimes, RSI thresholds are tighter. In bear regimes, DCA bands get extra weight.
Configurable macro toggle — free TradingView users can disable the L0 layer and run L1+L2 only. Pro+ users get the full three-layer stack.
Requirements
TradingView Pro+ for cross-market symbol references (L0 macro layer)
Free tier users: disable use_macro in settings to run L1+L2 simplified mode
Compatible with any crypto pair on TradingView (BTC, ETH, SOL, etc.)
Works on all timeframes, but designed for daily bars
Alert Integration
Four built-in alertcondition triggers:
V6 Buy Signal — action score ≥ 3 (Normal/Increase/Heavy Buy)
V6 Reduce Signal — action score ≤ 1 (Pause/Reduce)
V6 Deep Dip — DCA Band ≥ 4 (≥ -50% from ATH)
V6 RSI Oversold — RSI < 25 (panic zone)
Status
Production-ready. Full Pine Script v6 source available on Feishu: HODL V6 Smart DCA

免責聲明

這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。