Sunday, January 20, 2008

When to pull the plug


"Don't focus on making money; focus on protecting what you have" - Paul Tudor Jones.


It is common for those trading with mechanical systems, to have a system stop. This is the point where the system switches off, and is usually when the drawdown surpasses the maximum drawdown seen in backtesting.


The reason for this is, a larger maximum drawdown than seen in testing, is a sign that the system is trading in unchartered territory, and is trading in market conditions not seen in testing. This means that you are pretty much trading blind, and you can no longer have confidence that if you follow the system parameters, you will achieve the results seen in testing.


In the last 15 years (since 1992) we have only really seen one market, and that was between 2000-2003. The peak saw the All Ordinaries (XAO) at 3,450 which was roughly 01-07-2001 and the trough was 2,666 which was roughly at 01-03-2003. So in this 21-month period, the market lost 22.7%.


The testing of my system over this period, and this is a monte carlo analysis over 20,000 portfolios, showed the following results:



Simulation Stats
Number of trade simulations: 20000
Trades processed per simulation: 287
Maximum Number of Trades Executed: 70
Average Number of Trades Executed: 56
Minimum Number of Trades Executed: 40
Standard Deviation: 3.92

Profit Stats
Maximum Profit: $23,967.45 (36.31%)
Average Profit: $1,690.05 (2.56%)
Minimum Profit: -$14,030.01 (-21.26%)
Standard Deviation: $4,899.62 (7.42%)
Probability of Profit: 61.96%
Probability of Loss: 38.05%

Percent Winning Trade Stats
Maximum percentage of winning trades: 56.60%
Average percentage of winning trades: 37.07%
Minimum percentage of winning trades: 20.34%
Standard Deviation: 4.61%

Maximum Peak-to-Valley Percent Drawdown Stats
Maximum Absolute Percent Drawdown: 25.6386%
Average Absolute Percent Drawdown: 10.9312%
Minimum Absolute Percent Drawdown: 2.8526%
Standard Deviation: 2.8416%



So from the 20,000 portfolios, the worst portfolio lost 25.6%.

So if the live system reaches a drawdown of 26%, and these values apply only to closed equity, then the system will be shut down.


Now the obvious concern here, if we turn the system off, when does it turn back on?


We have to remember that historically the stockmarket has shown a strong bullish bias, and we have no reason to think this fact will change. As we can see from the chart above, the downtrends are usually sharp corrective moves, lasting 1,2,3,4,5 years, but then the market continues to go up again.


The reason long term trend following systems work so well (in the long term! mine is a bad example, LOL) is because they take advantage of this historical bullish bias that the stockmarket has shown. My system even works well in what you would call a very average market.
Between 1998-2003, the market averaged a return of under 7%p.a., well below its longterm average of about 11%p.a. Here are the stats for my system through this time:

Simulation Stats
Number of trade simulations: 20000
Trades processed per simulation: 1070
Maximum Number of Trades Executed: 182
Average Number of Trades Executed: 167
Minimum Number of Trades Executed: 151
Standard Deviation: 4.29

Profit Stats
Maximum Profit: $536,473.93 (812.84%)
Average Profit: $339,851.99 (514.93%)
Minimum Profit: $194,702.54 (295.00%)
Standard Deviation: $49,123.14 (74.43%)
Probability of Profit: 100.00%
Probability of Loss: 0.00%

Percent Winning Trade Stats
Maximum percentage of winning trades: 60.39%
Average percentage of winning trades: 51.50%
Minimum percentage of winning trades: 43.86%
Standard Deviation: 2.18%

Maximum Peak-to-Valley Percent Drawdown Stats
Maximum Absolute Percent Drawdown: 19.0027%
Average Absolute Percent Drawdown: 10.3125%
Minimum Absolute Percent Drawdown: 4.6984%
Standard Deviation: 1.9226%

So that's an average of about 35%p.a. Backtesting is not an exact science, but I'm more than happy with 20-25%. If I want to achieve these results I need to be in the market for a decent period of time.

So what I am looking at designing and testing over the next few weeks, is a system switch based on the index (XAO). It won't be designed to cash out at the top and buy back in at the bottom like a champion, but rather to keep my system out of a prolonged bearmarket. If I can achieve comparable results while enduring less pain (drawdown), they why not.
Some will say I should have implemented this from the beginning. Well, you live and you learn. And at the end of it all, it's only money.

8 comments:

Anonymous said...

hay Nizar,

i think we are all feeling your pain at the moment, great idea to switch to a system based on the index (XAO).

my friends and I did some intersting study and found that the major corrections and bear markets in Aust over the last 15 yrs have avg 8% and lasted 11 weeks (top to bottom) and take around 11 weeks to recover to previous peaks. Bear markets avg a pull back closer to 20% over 33 weeks and then take on avg 52 weeks to regain previous peaks.

the All Ordinaries is about to re-achieve the same price it was at one year ago, whether its going to recover and what time frame that recovery will take is the elusive qs.

ps hope you enjoyed th info i sent you

cheers
waleed
aka tigerchaser

Anonymous said...

Hi nizar,

thanks for addressing my question earlier. Hope it's a long time before you have to shut it down:-)

PF

Nizar said...

Hi Waleed,

Thanks for your comments.

Re: your study on corrections and bear markets, what was the definition of bear market exactly?

Because I thought the only bear market in the last 15 years was between 2000-2002, where the XAO lost about 23% peak to trough in 21 months.

Yes the information you sent me was great, thankyou.

Best regards,
Nizar.

Anonymous said...

Hello Nizar! Very nice blog! I read it all at once, and it seems that your way of thinking is very similar to mine. Keep up the good work, i'll visit it often.

One question, you said in an earlier post that you tested in Tradesim having it to have a preference on low value stocks. How can you do that with Tradesim?

Cameron said...

Hi Nizar,

What is your max DD experienced so far during live trading? How close are you to the system switch off point?

ASX.G

Nizar said...

Hi Termi,

I use MS, so i'll tell you the way I backtest with price ranking.

Add this line of code into your exploration:

ExtFml( "TradeSim.SetVariableTradeRank",C);

And then in TradeSim, before you load the trade database, go to Tools --> preferences, then click global parameters.

On your right, under "Sort Options" click on Rank (lower rank first).

This will give preference to lower priced stocks.

Obviously this only works for single portfolio simulation and not monte carlo analysis.

I have also tested by sorting by ROC, with larger rank first, and the results are quite similar.

ASX.G,

The drawdown at the moment (as of last week close) is 20.5%.

The max.DD in all historical backtests was 25.6%.

The system will be shut down at 26% drawdown.

Regards,

Nizar.

stevo said...

Nizar
I like the XAO system switch approach. A system that turns itself off and on may not make you any more money but it can save a bit of work and maybe save a bit of drawdown.

I put a ON/OFF switch in similar circumstances after the market dropped 10% in the 3 months after I started a system.

But, as far as I know all systems have drawdown. If you do develop a system without drawdown then tell me (and only me!) about it.

If you simulated startup on the following dates it could give some insight into drawdown on startup;

17/08/2001
22/02/2002
24/01/2003
18/03/2005
20/07/2007
02/11/2007

regards
stevo

Nizar said...

Hi Stevo,

Thanks for those dates, they will no doubt come in useful.

The thing that I believe is with longterm trend following systems on equities, is that they will always work.

Trends are a fundamental part of markets, so as long as there are markets, there will always be trends. And as long as there are trends, long term trend following systems will be profitable.

The problem is staying in the markets long enough to be able to take advantage of the long term historical bullish bias.

So if you turn such a system off because it has hit historical max.DD, there has to be a time when it turns on again. When? Well that's why we backtest.

I realise this switch will only improve closed equity drawdown but I guess thats ultimately whats important.

I'd be happy with less drawdown and proportionately less profits. But ratio of CAR/max.DD must stack up. This is the way I measure performance.

Stevo, the closest systems I have seen to having no drawdown are actually yours!!! Low single digits!! Thats's unreal.

Thanks for dropping by.

Nizar.