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

[amibroker] help on PositionSize



PureBytes Links

Trading Reference Links

I am finding that sometimes PositionSize grows too high for a 
reasonably balanced portfolio (ie more than i would ever lay out on a 
single stock).
Tomasz kindly provided a solution to an earlier problem which is the 
value for "y" below.
When i code this (trying to get round the 2nd problem i encountered)
/*----------------------*/
x=PositionSize;
y=BuyPrice*EMA(V,10)*.5;
/*don't try to buy the whole company!*/
z=Min(x,y);
z=Min(100000,z); // clumsy but shows the problem best
PositionSize=z;
/*----------------------*/
PositionSize still went above 100000 for some stocks in backtesting.
Position shrinking is turned on.
The initial equity is 10000.
Can some kind person tell me where i have gone wrong in the coding, 
please?



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/sOykFB/k9VGAA/ySSFAA/GHeqlB/TM
---------------------------------------------------------------------~->

Send BUG REPORTS to bugs@xxxxxxxxxxxxx
Send SUGGESTIONS to suggest@xxxxxxxxxxxxx
-----------------------------------------
Post AmiQuote-related messages ONLY to: amiquote@xxxxxxxxxxxxxxx 
(Web page: http://groups.yahoo.com/group/amiquote/messages/)
--------------------------------------------
Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 

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