PROTECTED SOURCE SCRIPT

52-Week High Drawdown (Events, Freq & Current)

104
52-Week High Drawdown - Events, Freq & Current

OVERVIEW
Track and analyze drawdowns from 52-week highs with comprehensive statistics on drawdown events, frequency, and current market positioning. Perfect for risk management, historical analysis, and understanding volatility patterns.

KEY FEATURES

📊 Real-Time Drawdown Tracking
  • Visual area chart showing current intraday maximum drawdown from rolling high
  • Automatically plots depth below zero line for easy interpretation
  • Color-coded reference lines at -10% and -20% levels


📈 Event-Based Historical Analysis
Automatically categorizes drawdown cycles across four severity zones:
  • 5-10% Drawdowns - Minor corrections
  • 10-15% Drawdowns - Moderate pullbacks
  • 15-20% Drawdowns - Significant corrections
  • 20%+ Drawdowns - Major corrections/bear markets


⏱️ Frequency Metrics
Calculates average time between events for each category, displayed as "Every X months" to understand typical correction patterns.

🎯 Current Cycle Tracking
Real-time display of maximum drawdown depth in the current cycle, helping you gauge present market position.

📅 Smart Timeframe Adaptation
  • Auto-Adjust Mode: Automatically selects optimal lookback (Daily=252, Weekly=52, Monthly=12)
  • Manual Mode: Set custom lookback period for specialized analysis


HOW IT WORKS

The indicator identifies drawdown cycles - periods from one high to the next. When price touches a new rolling high, the previous cycle ends and is categorized by its maximum depth.

Cycle Logic:
  1. Tracks deepest point reached since last high
  2. When price touches/exceeds rolling high, cycle completes
  3. Cycle categorized into appropriate drawdown zone
  4. New cycle begins


This provides accurate event counting without double-counting fluctuations within larger drawdowns.

PRACTICAL APPLICATIONS

Risk Management
  • Understand typical drawdown patterns for position sizing
  • Set realistic stop-loss levels based on historical norms
  • Anticipate potential correction depths during bull markets


Market Context
  • Identify when current drawdowns are extreme vs. typical
  • Compare across different assets and timeframes
  • Historical perspective during volatile periods


Strategic Planning
  • Time entries during typical correction zones
  • Recognize when drawdowns exceed historical norms
  • Build resilience strategies based on frequency data


SETTINGS GUIDE

Auto-Adjust Lookback by Timeframe
  • Checked: Automatically uses appropriate period for chart timeframe
  • Unchecked: Uses manual lookback value


Manual Lookback Length
  • Default: 252 (trading days in a year)
  • Customize for specific analysis periods
  • Higher values = longer historical perspective


Table Position
Choose from Top Right, Bottom Right, Top Left, or Bottom Left based on your chart layout.

INTERPRETATION TIPS

  • Frequency data becomes more reliable with longer history (5+ years ideal)
  • "Never" frequency indicates zero events in available data range
  • Current Cycle Max shows 0.00% at new highs, otherwise displays deepest point
  • Compare frequencies across assets to understand relative volatility profiles


BEST USED FOR

  • Stocks, ETFs, and Indices with sufficient historical data
  • Long-term investing and swing trading strategies
  • Portfolio risk assessment and stress testing
  • Educational purposes - understanding market behavior
  • Multi-timeframe analysis (daily, weekly, monthly)


TECHNICAL NOTES

  • Uses ta.highest() for efficient rolling high calculation
  • Event detection logic prevents double-counting
  • Frequency calculated from actual data start time to present
  • All calculations update in real-time with each new bar


💡 Tip: Run this indicator on major indices like SPY or QQQ with maximum available history to build a comprehensive baseline for equity market corrections.

Created to provide institutional-grade drawdown analysis in an accessible format. Free to use and modify.

Aviso legal

As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.