Click here to Login




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)

QuantShare Blog
QuantShare
Search Posts




QuantShare
Recent Posts

Create Graphs using the Grid Tool
Posted 1449 days ago

Profile Graphs
Posted 1554 days ago

QuantShare
Previous Posts

Sharpe Ratio - Part 2
Posted 5518 days ago

Sharpe Ratio - Part 1
Posted 5524 days ago

The 'inside period' function
Posted 5538 days ago

Quantshare version 1.4
Posted 5552 days ago

Looking for trading ideas
Posted 5558 days ago

A vector-based language
Posted 5561 days ago


More Posts

Back







QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.