Drawdown vs Returns

I'm completely new to programming algos.

In the backtest page, there's a return percentage vs a drawdown percentage. I looked up what drawdown means and I think the percentages mean losses. However, which number do I look at to see how profitable an algo is? The returns or the drawdown? I'm still very confused, thanks for any help.

14 responses

Tin, the drawdown refers to the amount of your capital which is drawdown (tied up) during the market fluctuation. For example if you had a balance of $10k and a 50% drawdown at some point the market moves against you during your trade$5k of your equity would be drawndown or "at risk". Obviously the market moves up and down, so drawdown also fluctuates, ideally the algorithm has a low drawdown because this means less of your capital is risked during a trade. I hope this awkward explanation helps you a little.

The returns are the profit indication, the drawdown is perhaps on measure of risk, but not the only or best one. Lower drawdown generally means a lower risk profile but may not mean risk:reward is as attractive.

Thanks, Ryan. That was really helpful. I noticed that when I was backtesting, the drawdown percentage stays pretty constant, regardless of how long I go back (at least in the sample algorithm). Is this generally true or should it fluctuate quite a bit?

Tin,

The degree to which drawdown increases or decreases is relative to the market and how your algorithm handles fluctuation in price and/or the change in whatever technical indicators it uses.

For example, if your algorithm opens positions based on the fluctuation of a very short term moving average and there was a week of extreme volatility and it opened a series of orders and then the market corrected and continued to trend you might find your drawdown increases because you have exposure and your drawdown increases as the market moves against you.

Generally the larger your sample date range the more market conditions you will encounter and the better idea of the average and maximum drawdown you might experience would be. Of course past experience is no guarantee of future movement just a guide.

Hi Tin,

I wanted to expand on Ryan's excellent explanation with some of the implementation details. Max draw down is defined as the largest peak to trough move in the period. In the full backtest results we calculate max drawdown over the entire test period, and over rolling periods. We use both realized and unrealized gains/losses in the calculation. Since it is the max in the period, it does tend to be less dynamic than performance, which changes constantly.

thanks,
fawce

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

John, thanks for the compliment. I thought it was of an awkward explanation really. I love what you're doing here. Well done!
I wondered if there was a way you could add a parameter to model trade cost? This currently hidden cost will impact P&L.

Ryan,

Do you mean commissions? In addition to estimating your trades' impact with slippage (https://www.quantopian.com/help#ide-slippage), we also provide a commissions model (https://www.quantopian.com/help#ide-commission). Is that cost you meant?

thanks,
fawce

Oops! Yes, even slippage. Great job. You guys have thought of everything. You might like to point any Python newbies to Code Academy for a free primer on how to script it. (I can't confess to be either a python guru or a quant expert sadly, but it's great to share thoughts here). Well done Fawce.

+1 for Forex when you get the time too.

Hello Ryan,

I'm in the same boat...neither a professional quant nor a Python guru. I hardly knew Python existed prior to getting involved in Quantopian (although I have a technical background and learned over the years BASIC, Fortran, C/C++, and most recently, MATLAB). You can write algorithms without any of the fancy Python object-oriented jazz. Also, I've been tending to get the data into a numpy array, which can then be manipulated just like in MATLAB (using numpy, scipy, etc.). Once you get a few things down, it's straightforward. With some googling, you can find lots of Python examples.

If you have a simple algorithm that you'd like coded as an example, just post the idea here...somebody can respond with the code to execute it and you'll be off and running!

Grant

Thanks for the explanations, Ryan and John. They're all very helpful.

Happy to help Tin. It's all teamwork. We're learning from each other :)

Thanks Grant. I used to program many moons ago, and python is a high level language so one of the easiest to learn, like you I am rusty. I'll have a tinker. Yes, the community here is already very good I can tell. I like how accessible the platform is. I'll have to apply some of my Forex learnings here. For equities I think pairs trading suits my risk profile. I've used a site called pairstrading.com which has some interesting filtering tools (some of which could be useful here) but having the ability to code algorithms and run backtesting here is very nice indeed.

I have no programming experience (Econ major) but I want to give a thumbs up to the Python track on CodeAcademy. I went through it and thought it was very helpful. Of course, if you have experience coding in something like C++ or Java, then Python should be very straightforward to pick up.

Good work Tin. You're on a roll now!

Ryan,

You might be interested in:

https://www.quantopian.com/posts/fixed-version-of-ernie-chans-gold-vs-gold-miners-stat-arb

Note that you can simply clone the algorithm posted by Thomas W. and run it yourself.

Grant

Thanks Grant. Interesting. My biggest overall surprise is how well many of these algorithms have none. I'm naturally a skeptic so I am wondering why they are all performing so well under backtest.

I cloned this https://www.quantopian.com/posts/global-minimum-variance-portfolio for example... and just ran a pair Coke/Pepsi and Fedex/UPS and both came up very well in testing.