OPEN-SOURCE SCRIPT

Drawdown %

402
Drawdown % — Real-Time Peak-to-Trough Analysis

This indicator provides a precise, real-time measure of drawdown as a percentage from the running peak of any source series. Unlike equity curve tools tied to strategy backtests, this is a pure price-based indicator compatible with any instrument and timeframe — no strategy execution required.
How it works
On each bar, the indicator tracks the highest observed value of the selected source (default: close). Drawdown is then calculated as the percentage decline from that running peak to the current value. The maximum drawdown — the deepest peak-to-trough decline observed across the entire chart history — is computed continuously and plotted as a persistent reference line.
Visual features

Area plot — the current drawdown curve fills dynamically, shifting from muted red to orange to solid red as losses breach the −5% and −10% thresholds
Max drawdown line — a persistent maroon line marking the worst historical decline
Reference levels — dashed horizontal lines at 0%, −5%, −10%, and −20% for quick visual orientation
Info table — a top-right overlay displaying current drawdown and maximum drawdown in real time, color-coded by severity

How to use it
Apply the indicator to any chart as a standalone pane. The source input defaults to close price but can be changed to open, high, low, HL2, or any other available source. Use the reference levels and table readout to monitor risk exposure, identify periods of sustained drawdown, and compare current conditions against the historical worst-case decline.
Compatibility
Pine Script v6 — works on all asset classes and timeframes.

© Babayaga-
profile link: in.tradingview.com/u/Babayaga-/

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.