[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] TJ: Traders Tips TASC August 2004



PureBytes Links

Trading Reference Links

I struggle in coding position sizing especially when it comes to 
having % limits on capital.

For example I can use 1% risk position sizing using the following 
code (A);

PositionSize = -1 * BuyPrice / (BuyPrice - stop); // 1% risk

The above code is simple and straight forward, but it doesn't take 
into account liquidity and my 10% maximum position size. It also 
doesn't allow for a minimum position size. 

Remember that Capital would change as the simulation progresses, 
ruling out simple filters such as positionsize < 0.01 * capital.

I want to limit position size to no more than 10% of capital and no 
less than say 2.5% of capital, as well as adding a liquidity filter. 
I can use the following code (B) although it looks a little clunky 
and doesn't cater for the changing equity as the simulation 
progresses;

// Position sizing
Capital = Param("Caps$",50000,20000,99000,1000); // Initial Equity
MaxPosSize = Capital * 0.01 ; // 10% Maximum Position size
MinPosSize = Capital * 0.025 ; // 2.5% Minimum Position size
Riskpc = Param("Risk%", 1, 0.5, 4, 0.1); // % risk divide by 100
InitStop = 2 * ATR(10);	// initial stop
Risk = riskpc / 100 * Capital; // % risk position sizing
PS1 = Min( ( Risk / Initstop) * Close , MaxPosSize ); // Max size or 
less 
PositionSize = Min( PS1, C * MA(V,13) * 0.08 ); 

The use of Min limits position size to a maximum of 8% of liquidity 
for the week. I am looking at longer term weekly systems.

Can I use the first code (A) above with liquidity and maximum / 
minimum limits. If I can do this then I can test profit pyramiding.

Hopefully this is understandable!

regards

Steve 





 



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Yahoo! Domains - Claim yours for only $14.70
http://us.click.yahoo.com/Z1wmxD/DREIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/