[R-SIG-Finance] holding period quant mod ?
Martin Bauer
Bauermartin at gmx.at
Thu Jan 5 17:31:08 CET 2012
Hello,
here is my code
require(quantmod)
require(PerformanceAnalytics)
sym=getSymbols("SPY",from="1900-01-01")
ma=SMA(Ad(SPY),20)
sigl=ifelse(Ad(SPY)>ma, 1, 0)
ret=lag(sigl,1)*ROC(Ad(SPY),type="discrete",n=1)
re=merge(ret,ROC(SPY[,6],type="discrete",n=1))
table.Drawdowns(ret, top=10)
table.DownsideRisk(ret)
What is missing here - after two days of investment the position should be close
Any ideas ? - any library available to use ?
Looking for support
Many thanks in advance
--
More information about the R-SIG-Finance
mailing list