Sunday, June 24, 2007

Donchian 20 day breakout Trading system with code

//License agreement for the code:
//You may freely redistribute this code in unmodified form.
//If you do make a profit using this code then you promise to donate the first
//500 rs to a charity for children.
//If you choose to redistribute a modified version of the code code
//then you must remove the license agreement from
//the code.
//The ideas here are not unique, they are simply a merger of Donchian breakouts with
//gann position sizing.
//gann says do NOT risk > 10% on a single position.
//donchian=20Day channel defines the trend.
//Important point: if you bet all your capital on individual breakouts you will go
//broke. Remember : diversification/risk management is important in the markets
//Copyright: Niftytraders
//Email: niftytradersinc@yahoo.com

Buy=C>Ref(HHV(H,20),-1);
Sell=Crisk=C/LLV(L,20);
SetPositionSize(risk/10*100,spsPercentOfEquity);

Here are the returns for a donchian 20 day breakout system with 10% risk per trade.. tested from 1994 to current.
Statistics
All trades Long trades Short trades
Initial capital 100000.00 100000.00 100000.00
Ending capital 2315906.21 2315906.21 100000.00
Net Profit 2215906.21 2215906.21 0.00
Net Profit % 2215.91 % 2215.91 % 0.00 %
Exposure % 85.30 % 85.30 % 0.00 %
Net Risk Adjusted Return % 2597.82 % 2597.82 % N/A
Annual Return % 28.22 % 28.22 % 0.00 %
Risk Adjusted Return % 33.08 % 33.08 % N/A

This is with brokerage of 0.2% per leg.
You can test with any setting you like up till 0.8% per leg
annual returns should remain > 20%
The testing was done on stocks from the futures segment from 1994-current
(reason for limited testing is that not all my spot data is split adjusted/bonus adjusted but my fno data is clean)

The big issue with donchian breakouts is that drawdowns are huge...
The max drawdown for this system is as high as 50%.
Hence trade at your own risk.

No comments: