[R-SIG-Finance] EndEquity lower than initEq despite positive p/l
algotr8der
algotr8der at gmail.com
Thu May 5 20:18:53 CEST 2011
-I back tested a basket (long / short) strategy from 2007-07-01 to 2010-07-30
using TWO portfolios.
-I created an account that holds the TWO portfolio's
-I set the initEq = 100,000 (see attribute 'initEq' in the snippet output of
getAccounts() below).
2010-07-27 0.00 34818.13
2010-07-28 0.00 34818.13
2010-07-29 0.00 34818.13
2010-07-30 0.00 34818.13
attr(,"currency")
[1] "USD"
attr(,"initEq")
[1] 1e+05
attr(,"class")
[1] "portfolio_account" "account"
-The End equity is = 34818.13 after running updatePortf, updateAcct, and
updateEndEq,
> getEndEq(Account=account.st, Date='2010-07-31')
[1] 34818.13
-However, the net P/L is positive, and you can see that in the output of
tradeStats for each symbol in the basket (see file below). If you add the
Net.Trading.PL.2 parameter for each symbol you get a total p/l = 34,818.13,
which is equal to the End Equity.
http://r.789695.n4.nabble.com/file/n3499089/tradeStats_output.txt
tradeStats_output.txt
-You can also see the equity curve as per the output of
'charts.PerformanceSummary' (see file below).
charts.PerformanceSummary(ROC(getAccount(account.st)$summary$End.Eq)[-1],
main="Basket Strategy Return")
http://r.789695.n4.nabble.com/file/n3499089/BasketStrategyReturn.pdf
BasketStrategyReturn.pdf
For some reason it appears that the starting equity is = 0 instead of
100,000.
Perhaps I have missed a step that is required to set the initEq = 100,000. I
created the account with argument initEq = 100000.
> initEq
[1] 1e+05
initAcct(account.st, portfolios=allportfolios, initDate=initDate,
initEq=initEq)
Appreciate some guidance.
--
View this message in context: http://r.789695.n4.nabble.com/EndEquity-lower-than-initEq-despite-positive-p-l-tp3499089p3499089.html
Sent from the Rmetrics mailing list archive at Nabble.com.
More information about the R-SIG-Finance
mailing list