TradingView backtesting guides

Drawdown duration: peak, trough and recovery

Drawdown duration measures how long equity takes to regain its previous peak. Paste dated equity values to separate the decline, recovery and unfinished time underwater. Compare average drawdown by event, observation and elapsed time.

One YYYY-MM-DD,equity row per date, earliest first, no header or thousands separators. Use 2 to 10,000 rows in one consistent currency or index scale. No market data is fetched.

The example is an invented seven-day equity path. Replace it with your own observations for an analysis of your data.

A seven-day timeline: three events, one still open

Assume daily observations, no cash flows and an equity index starting at 100. The load-example button uses the exact path below. All dates are in January 2026.

Hypothetical equity and drawdown, with a constant peak of 100
DateEquityDrawdownEvent
Jan 11000%Peak for event 1
Jan 29010%Below peak
Jan 38020%Trough for event 1
Jan 41000%Recovery 1; peak for event 2
Jan 5955%Trough for event 2
Jan 61000%Recovery 2; peak for event 3
Jan 79010%Sample ends; event 3 remains open

Event 1 takes 2 days to reach its trough and 1 more day to recover: 3 calendar days in total. Event 2 takes 2 days from Jan 4 to Jan 6. The average completed duration is (3 + 2) / 2 = 2.5 days. Event 3 has lasted at least 1 day; it has no observed recovery date.

Counting only strictly underwater observations gives two observations for event 1, while elapsed peak-to-recovery time is three days. Report the unit and convention alongside the number. A peak-to-trough duration alone omits the recovery.

Average drawdown depends on what receives the weight

For every observation, depth = (running peak − equity) / running peak × 100. This analyzer reports positive loss magnitudes. An event ends only when the prior peak is reached, so a partial rebound stays in the same event.

Four averages of the same hypothetical path
MeasureCalculationMeaning
Completed-event depth(20 + 5) / 2 = 12.50%Each recovered episode has equal weight.
All-event depth(20 + 5 + 10) / 3 = 11.67%Includes the open episode at its worst depth so far.
Observation average(0 + 10 + 20 + 0 + 5 + 0 + 10) / 7 = 6.43%Every sample counts, including dates at the peak.
Time-weighted depth(0 + 10 + 20 + 0 + 5 + 0) / 6 = 5.83%Six one-day intervals; each uses its starting depth.

With irregular dates, the time-weighted measure is Σ(depth × interval days) / total days. Holding values forward is an explicit approximation. It does not reconstruct the missing path. Changing to interpolation, excluding zero drawdowns or sampling only trade exits changes the statistic.

Open events and data boundaries

  • An open drawdown is right-censored: its eventual duration is unknown. Excluding it from completed averages may make recovery look faster; including its elapsed time as a finished duration is also misleading. Read the open row alongside the average.
  • The deepest drawdown need not be the longest. Compare event duration and depth separately, and retain shallow episodes instead of applying an undisclosed cutoff.
  • The first input value is the initial peak. A drawdown that began before the sample cannot be reconstructed. Missing dates can conceal earlier recovery or deeper losses.
  • Use a consistent, cash-flow-adjusted equity or return index. Deposits can create artificial recoveries, withdrawals can create artificial drawdowns, and unadjusted price series omit dividends or splits.
  • This input accepts nonnegative equity with a positive first value. Zero equity is a 100% drawdown; negative equity is outside this tool's supported domain. A 100% loss cannot recover through a finite percentage gain from zero.

Compare the same equity path in TradingView

TradingView's duration definition uses close-to-close equity and calendar days. Match that basis before comparing it with this analyzer. Closed-trade balances, daily marked equity and intrabar equity can show different depths and recovery dates. The official definition does not establish that this tool's open-event policy matches every TradingView report.

For trade-level analysis, export the TradingView List of Trades CSV and use Backtest Deep Report to review net profit, profit factor and maximum drawdown calculated from closed trades. This page independently calculates duration and average-depth conventions from your dated equity input; those conventions are not a promise that the report provides identical statistics.

If you need a custom equity sampling or on-chart statistic, describe the required definition to the Pine Script AI Coding Agent, then inspect and test the generated script in TradingView. Neither a report nor generated code can recover observations missing from the source data.

Frequently asked questions

What is drawdown duration?

Here, drawdown duration is elapsed calendar time from the last equity peak before a decline to the first observation at or above that peak. Peak-to-trough time and trough-to-recovery time are its two parts. Observations between dates are unknown.

How should I report an open drawdown?

Report its elapsed duration as a lower bound and its recovery date as unknown. This analyzer excludes open events from completed-event average duration and shows their depth separately in the event table. An open event can still become deeper or longer.

What does average drawdown mean?

The denominator matters. An event average gives each episode one vote using its deepest decline. A sampled average uses every entered observation, including zero drawdowns. A time-weighted average weights drawdown by elapsed time. These values need not agree.

Why might this differ from TradingView?

TradingView documents its average drawdown duration using close-to-close equity and calendar days. A list of closed trades does not contain the full mark-to-market equity path. Match sampling, dates, costs, capital flows and treatment of unfinished events before comparing results.

Does this tool fetch historical stock prices?

No. It calculates from the dated equity values you paste. The load-example button provides a fixed hypothetical series, not market history. TradingView trade CSV files belong in Backtest Deep Report, not in this two-column equity input.

Definitions and sources

TradingView: average drawdown duration provides the calendar-day, peak-to-recovery basis. PerformanceAnalytics: AverageDrawdown documents averaging observed event depths. The worked example and time-weighting convention above specify this calculator's own calculations.

For peak-to-trough depth alone, use the maximum drawdown calculator. Return to the backtesting guides for related measurement topics.

Review the trades behind your equity curve

Use Backtest Deep Report for a TradingView trade CSV. Keep the dated equity analysis above when you need an explicit duration or averaging convention.

Explore Backtest Deep Report

For research and education, not investment advice. Historical drawdown is not a ceiling on future loss, and the recovery estimator is an assumption-based scenario.