[Blotter-commits] r390 - pkg/quantstrat/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Sep 8 22:45:32 CEST 2010
Author: braverock
Date: 2010-09-08 22:45:32 +0200 (Wed, 08 Sep 2010)
New Revision: 390
Modified:
pkg/quantstrat/R/strategy.R
Log:
- apply patch 1065 from Mstislav Elagin (m_elagin)
- fix assignment of sret in strategy symbols loop
Modified: pkg/quantstrat/R/strategy.R
===================================================================
--- pkg/quantstrat/R/strategy.R 2010-09-08 20:36:08 UTC (rev 389)
+++ pkg/quantstrat/R/strategy.R 2010-09-08 20:45:32 UTC (rev 390)
@@ -93,12 +93,9 @@
symbols<-names(pobj$symbols)
sret<-list()
for (symbol in symbols){
- ret[[portfolio]][[symbol]]<-list()
- #if(!hasArg(mktdata)) mktdata <- get(symbol)
- #TODO FIXME allow passing of mktdata again?
mktdata <- get(symbol)
- #print(head(mktdata))
- #loop over indicators
+
+ #loop over indicators
sret$indicators <- applyIndicators(strategy=strategy , mktdata=mktdata , parameters=parameters, ... )
#this should be taken care of by the mktdata<<-mktdata line in the apply* fn
if(inherits(sret$indicators,"xts") & nrow(mktdata)==nrow(sret$indicators)){
@@ -106,7 +103,7 @@
}
#loop over signal generators
- sret$signals <- applySignals(strategy=strategy, mktdata=mktdata, ret$indicators, parameters=parameters, ... )
+ sret$signals <- applySignals(strategy=strategy, mktdata=mktdata, sret$indicators, parameters=parameters, ... )
#this should be taken care of by the mktdata<<-mktdata line in the apply* fn
if(inherits(sret$signals,"xts") & nrow(mktdata)==nrow(sret$signals)){
mktdata<-sret$signals
@@ -117,9 +114,10 @@
sret$rules<-list()
sret$rules$nonpath<-applyRules(portfolio=portfolio, symbol=symbol, strategy=strategy, mktdata=mktdata, Dates=NULL, indicators=sret$indicators, signals=sret$signals, parameters=parameters, ..., path.dep=FALSE)
sret$rules$pathdep<-applyRules(portfolio=portfolio, symbol=symbol, strategy=strategy, mktdata=mktdata, Dates=NULL, indicators=sret$indicators, signals=sret$signals, parameters=parameters, ..., path.dep=TRUE)
- }
- ret[[portfolio]][[symbol]]<-sret
- }
+
+ ret[[portfolio]][[symbol]]<-sret
+ }
+ }
return(ret)
}
More information about the Blotter-commits
mailing list