TradingView backtesting guides

Maximum Drawdown Calculator

Maximum drawdown is the largest decline from an earlier running peak to a later trough in your selected sample. Enter two values to measure one decline, or an ordered equity series to find the maximum and its recovery period.

Free calculation in your browser. Enter your own values; this tool does not fetch stock prices.

Maximum drawdown formula and running-peak algorithm

For each observation t, keep H(t), the highest equity seen from the start through t. Compute D(t) = 100 × (H(t) − E(t)) / H(t). Maximum drawdown is max D(t). Never sort the values: their time order determines which peak was available before each loss.

Cash decline is H(t) − E(t). Recovery gain is 100 × (peak − trough) / trough. This calculator uses positive loss magnitudes, starts the running peak at the first input, and includes unrecovered declines. It keeps the first tied maximum and uses the latest equal high before a decline.

The running-peak denominator follows Fidelity's drawdown visualizer explanation. A zero starting value or negative equity is outside this calculator's domain. A later zero is a 100% loss, with no finite recovery gain from zero.

Worked example: 25% down, 33.33% back up

The prefilled sequence is a hypothetical account in currency units, not stock history. If each row is one trading-day close, the durations below are trading-day intervals.

Running peaks and drawdowns for the example equity sequence
ObservationEquityRunning peakDrawdown
110,00010,0000%
212,00012,0000%
39,00012,00025%
410,80012,00010%
512,00012,0000%
615,00015,0000%
713,00015,00013.33%

The maximum is (12,000 − 9,000) / 12,000 = 25%. Peak to trough takes one interval. Recovery first occurs at observation 5: two intervals after the trough and three after the peak. The required gain is 3,000 / 9,000 = 33.33%. Ending at 13,000 does not erase the earlier loss.

Pairing the later 15,000 high with the earlier 9,000 low would produce 40%, but that reverses time. Another sequence, 100, 50, 200, 120, has a 50% maximum percentage decline at observations 1 to 2, while its largest cash decline is 80 at observations 3 to 4 (40%). Track both independently.

Choose the equity series before comparing reports

  • Closed-trade balance reflects realized results. Marked-to-market equity also includes open positions. A trade-close sequence can miss an unrealized loss between exits.
  • Daily closes omit intraday extremes. Monthly observations can miss daily troughs. More frequent observations can reveal a larger loss; never compare sampling frequencies without labeling them.
  • Use one currency and consistent treatment of fees, dividends and external cash flows. Deposits can resemble recovery; withdrawals can resemble losses. Use a cash-flow-adjusted series when measuring investment performance.
  • An unrecovered drawdown remains in the maximum. Its completed recovery time is unknown. The deepest decline and the longest period under water need not be the same event.

TradingView close-to-close drawdown uses closing equity. Its intrabar drawdown calculation accounts for price movement while positions are open. This sequence tool does not reproduce that intrabar model. Check the exact metric name and denominator before expecting matching numbers.

TradingView also labels a separate metric drawdown as a percentage of initial capital. For the example above, the 3,000 loss is 30% of the initial 10,000 but 25% of its 12,000 peak. Those denominators answer different questions.

Maximum drawdown keeps the single deepest percentage decline. Ulcer Index averages squared percentage drawdowns before taking a square root, so sustained smaller losses affect it differently.

Frequently asked questions

Methodology sources checked October 17, 2026. Examples are hypothetical arithmetic. Historical drawdown is not a forecast or a limit on future losses. Educational information, not investment advice.

Review drawdown in your TradingView trade sequence

Backtest Deep Report imports TradingView List of trades CSV data and calculates an equity curve from trade results. Check initial capital, costs and included trades before comparing its drawdown with this calculator. Trade records alone cannot reconstruct the full intrabar equity path.

Explore Backtest Deep Report