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

Re: [amibroker] US historical data



PureBytes Links

Trading Reference Links

I'm confused about the way AB is determining PositionSize. Can anyone help out? Here's an example:

Assume starting capital is 50000, PositionSize = -10; Commission is zero, Buyprice is Open, and Tradedelay = 1. 

The following is from a detaled log backtest of a *weekly* system - so these are consecutive bars. My comments are indicated by hyphens: 


2/08/2002
Entry signals(score):
Exit signals:
0 Open Positions: , Equity: 50000, Cash: 50000

- Buy signal for stock HIG to be bought next bar



9/08/2002
Entry signals(score):HIG=Buy(999.69),
Exit signals:
###Enter Long, HIG, Price: 0.31, Shares: 16129, Commission: 0, Rank:
999.69, Equity 50000, Margin Loan: 0
1 Open Positions: HIG, Equity: 50161.3, Cash: 45000

- HIG opened at 0.31, so 5000 / 0.31 = 16129. HIG closed at 0.32, so closing equity = 50000 + (16129 * 0.01) = 50161.3. 
- Buy signal for stock OXR to be bought next bar



16/08/2002
Entry signals(score):OXR=Buy(999.685),
Exit signals:
###Enter Long, OXR, Price: 0.315, Shares: 15949, Commission: 0,
Rank: 999.685, Equity 50241.9, Margin Loan: 0
2 Open Positions: HIG, OXR, Equity: 50162.2, Cash: 39976.1

- This is where I'm confused. Wouldn't portfolio equity at the Open of this bar be the same as closing equity calculated at the previous bar (ie 50161.3), and thus shares bought be 5016.13 / 0.315 = 15924 ?

- But AB shows equity as 50241.9 and so buys 5024.19 / 0.315 = 15949 shares.

- It seems that AB is calculating portfolio equity at the Open for this bar (and thus for the purchase of OXR) by incorporating the impact on equity of the existing holding (HIG) that occurs by the *Close* of this bar:

- HIG Close for this bar is 0.325, so 16129 * (0.325-0.32) = 80.64. This is the difference between 50161.3 and 50241.9.

- But this amount of 80.64 cannot have been known at the *Open* of the bar since it depends on HIGs price at the *Close* of the bar. (?)

Any ideas?

Thanks
Paul




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/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/