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

[amibroker] Re: help on PositionSize



PureBytes Links

Trading Reference Links

Tomasz kindly came to the rescue again with this explanation which 
may help others avoid the same problem i had:
 
initial value of PositonSize is -100. Negative values represent 
PERCENT of available equity.
-100 means 100% of equity. Your min(x,y) will always give -100.
 
Also PositionSize is the ARRAY not a single value, and each bar 
represents the suggested position value
if trade is entered at that bar. To carry forward the value you can 
use ValueWhen function.




--- In amibroker@xxxxxxxxxxxxxxx, "gerryjoz" <gerryj@xxxx> wrote:
> 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 ---------------------~-->
Free shipping on all inkjet cartridge & refill kit orders to US & Canada. Low prices up to 80% off. We have your brand: HP, Epson, Lexmark & more.
http://www.c1tracking.com/l.asp?cid=5510
http://us.click.yahoo.com/GHXcIA/n.WGAA/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/