Drawdown % vs. Closed Drawdown % visualizer
Author: fritz
Creation Date: 8/24/2010 4:42 PM
profile picture

fritz

#1
I'm confused by the different results I see between DD% and DD% (closed). The concept makes sense but it doesn't jive with what I'm seeing.

I'm testing a system that runs on 15min bars and closes all positions at the end of each day. So the difference between the open and closed equity is very small and should match at the end of each day. But I consistently see DD% and DD% (closed) values that differ by as much as 2:1. E.g. my current test has DD% of 31.93% and DD% (closed) of 16.63%. Looking at the Equity+Drawdown% curve, it's clear the worst drawdown is just over 30%. I can zoom in on the equity curve and see the day-by-day results, which clearly show the open equity and closed equity match within a few percent during the worst drawdown.

Where is DD% (closed) getting its 17% figure!? I wish it was accurate but it doesn't seem to reflect reality!

Gary
profile picture

Eugene

#2
You didn't mean to tell "Community Scorecard", didn't you? That's for optimizing and ranking.

Then, where does the figure comes from -- the "Performance+" tab? or the "Closed equity" chart (which visually looks misaligned - a fix is coming tomorrow)?
profile picture

fritz

#3
No, I meant "Community Scorecard," used in optimizing and ranking.

In my optimization run, DD% (closed) runs about half of DD%. Why?
profile picture

Eugene

#4
No idea where is this thing coming from. Just made a test on 3 years of 15-min AAPL bars, using the canned Moving Average Crossover goodness.

My drawdown on unrealized equity is nearly identical compared to the max DD on closed equity, e.g. -24.69% vs. -24.61%.

For sure, we'd need more details to be able to reproduce the issue.
profile picture

fritz

#5
Hm. It seems to depend on the size of the basket you're trading.

I just ran the MA Crossover script on a single stock (AA, **daily** bars) with Slow = 50 and Fast = 5 to 45 by 5, starting 4/1/09. DD% and DD% (closed) were significantly different but it was like 1.5% vs. 0.5%.

Now try running it on the Dow 30 starting 4/1/09, still daily bars. I get Drawdown% in the -4 to -5% range -- but Drawdown% (closed) ranges from -0.46% to -1.22%.

Oddly enough, I tried repeating the same test on some 15min stock data, and I saw no difference even with 10 stocks in the basket.

If you can't replicate it with this, I'll open up a ticket and send you my system.
profile picture

Eugene

#6
Drawdown on closed equity is always lower than on open equity, so -4% vs. -1% is expected. You could use the Closed Equity Drawdown visualizer to track and run the usual DD chart side by side to compare.
profile picture

fritz

#7
I must be misunderstanding something... the Closed Equity in WL makes no sense to me.

If I enter a trade, the open profit adds to my equity but not my closed-trade equity. If I then close it, the profit from the trade is added to my closed equity. While no trades are open, the open and closed equity are identical, yes?

And if my system opens trades every day, and CLOSES all trades every day, the open and closed equities should be identical at the close of every day, correct?

If so, I don't understand how WL is calculating the closed equity. Here is an equity curve from my system, along with the closed equity and closed equity DD.






I see why the closed equity DD is so small -- what I don't understand is why the closed equity looks nothing like the Equity+Drawdown% chart! ALL positions are closed every day. How could the open/closed equity be so different!? The "Strategy Equity" line in the Closed Equity chart matches the "Equity" line in the Equity+Drawdown% chart. The closed equity is 2-3x larger than the Strategy Equity! How can that be if all positions are closed every day??

Very confused...
Gary
profile picture

Eugene

#8
The closed equity isn't larger, it's at best misaligned. Which build of Visualizers do you have installed?
profile picture

fritz

#9
Oh and BTW: the "Closed Equity" and "Strategy Equity" lines on the Closed Equity chart both say they end at just about $175M -- even though the "Strategy Equity" line is below the $150M level!

And if you change the scale to log, the "Closed Equity" line changes but the "Strategy Equity" line doesn't!?

Something is NOT right here.
profile picture

Eugene

#10
See above.
profile picture

fritz

#11
Um. I think it's the "Extra Performance Visualizers," in which case it's 2009.12.

I updated to the 2010.05 version -- no change.
profile picture

fritz

#12
And it's more than just misaligned. I picked a date to compare: on 1/2/09, "Strategy Equity" is about $33.9M, according to the tooltip popup. This agrees with the equity curve in Equity+Drawdown%. "Closed Equity" on that same date is over $105M!
profile picture

Eugene

#13
Try updating to 2010.09, there's a fix for that misalignment. Let me know how it goes there please.
profile picture

fritz

#14
How? The Extension Manager only offered 2010.05. The Update Now button is grayed out. The "More Extensions" link isn't there.

On the Extensions webpage there is a "Performance Visualizer library" (not the "Extra Performance Visualizers" I already have) with a 2010.09 date. But I downloaded the WLE file and it requires WL6.

EDIT: Oh, and I told it to show "Other Extensions" and it showed a "Community Performance Visualizers Pack" with a 2010.09 date. But that also requires WL6.
profile picture

Eugene

#15
Yes, Wealth-Lab 6 is now required to install this and many other extensions.
profile picture

fritz

#16
OK, I upgraded to 6. Now the script I was running on WL5.6 won't run; it says "Strategy must set RiskStopLevel in order to use Maximum Risk position size."

1. It *DOES* set RiskStopLevel, and it worked just fine in 5.6.
2. It does this even if I set the position sizing to 1 contract, or fixed dollar size, or anything else.
profile picture

fritz

#17
Aha -- pilot error, at least partly.

If you just click "Go," it produces that (misleading) error.
If you enter the editor and Compile, it tells you that Community.Indicators is missing.

So back to the Extensions...

With the current release the misalignment has been fixed -- both curves use the same scale, including when you switch to log scale.

But the closed equity is still significantly higher than the "Strategy Equity," and that still makes no sense to me. Nor do I understand why (in this particular example) the "Closed Equity" goes flat 4 weeks before the end of the test, even though the trade listing shows over 60 opened and closed trades during that period! The growth of the "Strategy Equity" during that time accurately reflects the profits made during that period. So why did closed equity go flat?

profile picture

Eugene

#18
Re: missing - reinstall Community.Indicators to get rid of the message.

Did you restart after installing Visualizers 2010.09? If you did already, could you help me reproduce what you're seeing?
profile picture

fritz

#19
Yes, I reinstalled Community.Indicators, and I did restart after installing Visualizers.

I can't seem to replicate this behavior in any of the standard systems. I'll open a ticket and submit my system that shows the behavior.
profile picture

Eugene

#20
OK. I see the data loading range already but please also indicate the symbols and the data provider(s).
profile picture

fritz

#21
It seems to be specific to baskets of futures. Run it on a basket of stocks, run it on individual futures, and the closed equity looks sensible. Run it on a basket of futures and you get behavior like you see above.

I'm using text data files for the futures so I'll include those in the ticket.
profile picture

Eugene

#22
QUOTE:
So why did closed equity go flat?

The "plateau" indicates there were open trades that weren't closed.
QUOTE:
It seems to be specific to baskets of futures.

Thanks for the hint. Ran many MSBs of various systems on two futures portfolios.

1. On a mixed portfolio which includes futures symbols not defined in Symbol Info Manager, I see an occasional closed equity running higher than the open equity.
2. On a straight portfolio of 20 futures, each one defined in Symbol Info Manager, both equity lines went almost head-to-head.

My current suggestion would be to check that all your futures symbols are defined properly in the Symbol Info Manager tool i.e. it's not a mixed DataSet.
profile picture

Eugene

#23
btw, found a minor bug (to be fixed) - closed equity didn't account for entry/exit commissions.
profile picture

fritz

#24
QUOTE:
The "plateau" indicates there were open trades that weren't closed.

But there **AREN'T** any. I'm looking at a test that shows a closed-equity plateau from 4/9 to 5/28 (the end of my 15min data). Meanwhile the Trades listing shows all 100 trades in that period being opened and closed on the same day. (Actually some are entered the night before, then exited the next evening, but all are closed within 24 hours.) The only open trade in this test is the last trade, entered on 5/28.

I'm 99.99% sure all futures symbols in this test are defined in the Symbol Info Manager. I just ran a test with a smaller DataSet (8 symbols) and verified that all 8 of them were in the Symbol Info Manager. (The profits corresponded to the point values I specified in the SIM.) With the smaller list of symbols the closed-equity errors weren't quite as severe, but they were still obviously wrong.

The fact that this only happens with MSBs of futures, and the bogus plateaus, make me suspect more bugs in the visualizer. The fact that I can only make it happen with my system makes me wonder if I've got something wrong there too...
profile picture

Eugene

#25
I already made the source code open in the Wiki. It would be appreciated if you find any other [than not honoring commissions] bug in the closed equity calculation.
profile picture

fritz

#26
Sorry, Eugene, I just can't. I've already spent WAY more time on this than I should have, just isolating the problem. I can't spend a whole bunch of time learning the code.
profile picture

Eugene

#27
No problem. Having some more clues (the data used, data loading range, Symbol Info Mgr settings, Commission/Backtest/Slippage preferences) and some code to reproduce it would be appreciated too.
profile picture

fritz

#28
Is the symbol dictionary stored in an XML file or something? I can't find it. If it is, I'll include it with my ticket. Otherwise I'll just have to send a screen shot of my SIM.
profile picture

Eugene

#29
Sure, in SymbolInfo.xml. See User Guide > Data > Where data are stored, enable hidden file/folder visibility in Windows (Folder options).
profile picture

fritz

#30
Got it. I'll get a ticket in.
profile picture

Eugene

#31
The problem has been identified and a workaround is coming in the next build.
profile picture

DaveAronow

#32
Eugene,

Just curious can you provide more details? I saw some weird stuff in there awhile back but never got time to step through it.

Thanks.
Dave
profile picture

Eugene

#33
Becoming aware of some "gotcha" in PosSizer development helped me understand the cause of a couple of long-standing closed equity bugs in Visualizers, and a possible workaround.

Basically, one shouldn't use EntryBar/ExitBar in PosSizers (and Visualizers as I realized yesterday). Checking for EntryBar/ExitBar equality might fail because the different historical DataSets aren't synchronized when backtesting. Checking for the date with EntryDate/ExitDate rather than the bar number should work.
profile picture

DaveAronow

#34
Interesting, thanks for the info.
Dave
profile picture

innertrader

#35
I have only recently learned about the system's DD closed stats and visualizer. Are DD and DD (Closed) calculated the same way, i.e. from the peak of the value for that particular trade?

I am trying to understand how to use these to rank strategies that are otherwise similar in other metrics but have better scores in one or the other type of DD, but not both. Is Closed DD a more important metric than DD to rank a strategy, particularly in the risk dimension? I appreciate any thoughts you have on this topic.


profile picture

Eugene

#36
QUOTE:
Are DD and DD (Closed) calculated the same way, i.e. from the peak of the value for that particular trade?


Drawdown is calculated from the peak of the equity.
DD (Closed) is also calculated from the peak of closed equity.

Closed equity is calculated by taking the starting capital and adding (or subtracting) the PnL of closed trades only. It does not consider the value of open positions on each bar, only taking into account the value on the exit bar instead.
profile picture

innertrader

#37
Eugene, thank you for correcting my misunderstanding of closed DD calculation. Now that I understand it, I am wondering what the practical application of this metric is. I can see how for fully in/out trading strategies it could be indicative of worst-case financial downside risk. But for strategies that are portfolio-based, there is usually a mix of open and closed (cash or equivalent) equity. Not sure where I could get a real-time report on my current closed equity if I wanted it. Financial service providers, like Fidelity, uniformly report account value that includes both types of equity.