#twitter-follow { border: 0;position: fixed; top: 240px; left:0;} #live-support { border: 0;position: fixed; top: 370px; left:0;} #knowledge-base { border: 0;position: fixed; top: 170px; left:0;}

### The average maximum drawdown metric

Updated on 2009-10-27

In this post, we will show you how to calculate a custom metric which is the average maximum drawdown of all analyzed securities.We will first calculate the maximum drawdown for each symbol and then average the results.

The rules metrics editor:
From the menu, click on "Analysis" then "Rules Manager". Select or create a list of rules, then click on "Analyze".
In the "Rules Analyzer Settings" form, select "Metrics" in the left panel. Click on "New" to add an empty metric, and then click on the green dot to edit the metric.

Calculating the maximum drawdown of a security:
Imagine you start with an initial equity of 100\$ and that a certain rule generates the following outputs (returns in this case): 10%, -10%, 5%, -10%, 10%
To get the different equity values after each return, you need to multiply the last equity number with the following factor: (1 + (Return in percentage / 100))
Your equity sequence will be: 100\$ * (1 + (10 / 100)) = 100\$ * (1 + 0.1) = 100\$ * 1.1 = 110\$, then 110\$ * 0.9 = 99\$, then 103.95\$, then 93.55\$, then 102.91\$.

We have to create the maximum equity series by selecting the maximum equity number from the preceding equity values.
Equity series:       100 , 110 , 99 , 103.95 , 93.55 , 102.91
Maximum equity series: 100 , 110 , 110 , 110 , 110 , 110

Note that if we add a value of 120 to the equity series, the corresponding maximum equity value will be 120.
If we add another value of 110 to the equity series, the last maximum equity series value will stay at 120.

Now, for each element of the series, divide the equity series values by the maximum equity series values, subtract the result by one then multiply it by 100. The resulting series is the drawdown series: 0% , 0% , -10% , -5.5% , -14.95% , -6.44%
The maximum drawdown is the lowest value of the preceding series which is -14.95%, and this is the maximum you can lose if you have invested in that particular security.
In order to calculate our metric, we need to calculate the maximum drawdown for all securities and then average the result.

Implementing the metric:
Here are the steps to implement the metric:

- Loop through the symbols:

- Define the variables:

- Loop through the symbols' positions

- Calculate the current equity and the maximum equity value

- Calculate the current and the maximum drawdown

- Outside the symbols' positions loop, calculate the sum of the drawdowns and increment a counter

- Outside the symbols loop, calculate the average maximum drawdown metric

You can download the AMD metric here (Average Maximum Drawdown)

 no comments (Log in)

 Search Posts Recent Posts Backtesting a Strategy Based on Bond and Stock Index ETFs Posted Yesterday 4 Links to Download Free Historical Stock Prices Data by Date Posted 8 days ago Quantitative Analysis: Price Channels Posted 13 days ago How to Download Trading Data for Certain Securities Only Posted 22 days ago Learn How to Create Your Own Technical Analysis Indicators Posted 30 days ago How to Pick the Best Trend Indicators Posted 41 days ago Update Chart Layout based on Active Ticker Symbol - Part 2 Posted 57 days ago Previous Posts The average maximum drawdown metric Posted 1332 days ago Introduction to the trading rules analyzer Posted 1339 days ago Sharpe Ratio - Part 2 Posted 1346 days ago Sharpe Ratio - Part 1 Posted 1352 days ago How to speed up quotes and news downloads Posted 1360 days ago The 'inside period' function Posted 1366 days ago How to use date components in your trading rules Posted 1374 days ago Quantshare version 1.4 Posted 1380 days ago Programming skills are not that important Posted 1381 days ago Looking for trading ideas Posted 1386 days ago A vector-based language Posted 1389 days ago QuantShare - review by the Stock Trading Software Reviews Posted 1392 days ago Rules performance for different volatility regimes Posted 1395 days ago

 Company About Us Privacy Terms of Use Copyright © 2012 QuantShare.com Social Media Follow us on Facebook Follow us on Twitter