Can anybody help me calculate "Max Strategy Drawdown %" as shown in the strategy testor.
TV mentions the formula for Drawdown dollar value:
"Highest Equity of all time - Lowest Equity after the highest peak"
While Percentage Drawdown is calculated relatively:
The percentage and absolute values of a drawdown are two different metrics. They are tracked independently. For example, let’s say the initial capital is $100. After a series of losing trades, equity decreases to $50. The drawdown amounts to $50 in absolute terms and 50% in relative terms. Later, after a series of profitable trades, equity increases to $300 and then drops to $200. In this case, the absolute drawdown will be $100, and the relative drawdown, 33%. The overall maximum absolute drawdown of the strategy will be $100, and the maximum relative drawdown will be 50%.
//@version=5
strategy("Max Drawdown")
maxDrawdown = (strategy.max_drawdown/strategy.initial_capital * 100)
longCondition = ta.crossover(ta.sma(close, 14), ta.sma(close, 28))
if (longCondition)
strategy.entry("My Long Entry Id", strategy.long)
shortCondition = ta.crossunder(ta.sma(close, 14), ta.sma(close, 28))
if (shortCondition)
strategy.entry("My Short Entry Id", strategy.short)