[R-SIG-Finance] EndEquity lower than initEq despite positive p/l

algotr8der algotr8der at gmail.com
Fri May 6 02:51:22 CEST 2011


Okay - here is a bogus strategy just to test this -

http://r.789695.n4.nabble.com/file/n3500326/bogusStrategy.R bogusStrategy.R 

a) portfolio_1 = IBM, UTX, CAT

b) portfolio_2 = MSFT

Indicators = 10 DSMA, 15 DSMA, 20 DSMA

Rules

a) if 10_DSMA Crosses Above 20_DSMA BUY stocks in portfolio_1 AND COVER
existing SHORTS in portfolio_1
b) if 10_DSMA Crosses Below 20_DSMA SELL existing long positions in
portfolio_1 AND SHORT all stocks in portfolio_1

c) if 15_DSMA Crosses Above 20_DSMA BUY stocks in portfolio_2 AND COVER
existing SHORTS in portfolio_2
d) if 15_DSMA Crosses Below 20_DSMA SELL existing long positions in
portfolio_2 AND SHORT all stocks in portfolio_2

Once you have updated the portfolios and accounts type the following:

> getAccounts(account.st)

Look at the 'End.Eq' column (this is the last column). You will see that the
portfolio begins with 0 as the initial value and each day's p/l is added to
0 until the last day.

2010-07-02         -989.49  85836.10

Maybe I am misunderstanding something but it appears to me that the p/l of
this strategy = 85836.10 and so that amount should be added to the initEq. 

In my real strategy I know the p/l is ~34800, which should be added to the
initEq.






--
View this message in context: http://r.789695.n4.nabble.com/EndEquity-lower-than-initEq-despite-positive-p-l-tp3499089p3500326.html
Sent from the Rmetrics mailing list archive at Nabble.com.



More information about the R-SIG-Finance mailing list