Monday, July 09, 2007

3D charts & Trade-offs

The 3d plots are from a new system I have been working on and show a 2 variable optimise. The first chart plots Compound Annual Return, whilst the 2nd chart looks at drawdown. I find the 3d charts feature of AmiBroker a very useful tool - that's why I am posting these charts here.

What would be nice is if we could have 4 or 5 dimensional charts! I tried using Excel surface charts to get more insight but the 3d Amibroker charts are more convenient.


One variable (ATR multiplier) didn't have much impact over the range I tested - I could choose pretty much any value in the relatively tight range I tested. This suits me.


As is often the case using the values that give the best draw down result in lower CAR and visa versa. I could trade off CAR for lower draw down.

What was good is that I finally coded up profit target code. The following code was posted on the Yahoo AmiBroker site courtesy of Tomasz Janeczko;

/* a sample low-level implementation of Profit-target stop in AFL: */
Buy = Cross( MACD(), Signal() );

priceatbuy=0;

for( i = 0; i < BarCount; i++ )
{
if( priceatbuy == 0 && Buy[ i ] )
priceatbuy = BuyPrice[ i ];

if( priceatbuy > 0 && SellPrice[ i ] > 1.1 * priceatbuy )
{
Sell[ i ] = 1;
SellPrice[ i ] = 1.1 * priceatbuy;
priceatbuy = 0;
}
else
Sell[ i ] = 0;
}

All I had to do was modify it so that I also tested for a trailing stop. I initially tested using APPLYSTOP code but to set up the system I was more comfortable coding up the profit exit. Because the Sell is dependent on the buy what sounds quite easy does require something like the code above. GP's document on looping was also of value - it's in the files section of the Amibroker Yahoo site. The Yahoo site is a wonderful resource.

I will run some TradeSim tests before I take the system I have been working on live. As usual for me it's a longer term weekly system. I think I will call it Chaos, although Chicken & Chips is tempting! There is a small restuarant that does wonderful chicken & chips at Crows Nest and I do like my food. Why not name a system after food I like?

regards
Stevo

No comments: