[R-SIG-Finance] quantstrat demo error

Brian G. Peterson brian at braverock.com
Sun Sep 23 13:36:59 CEST 2012


On 09/22/2012 11:23 PM, 该走了 wrote:
> Hi, everyone,
>     I was trying to run some demo in quantstrat package, but got some error:
>     I ran  demo("macd") in R command line, but get an error message like
> this:
>
>> library(quantstrat)
>> demo("macd")
> .....
>> out<-try(applyStrategy(strat.st , portfolios=portfolio.st,parameters=list(nFast=fastMA,
> nSlow=slowMA,          nSig=signalMA,maType=maType)))
> Error in if (!is.na(timestamp) && (ruletype == "chain" ||
> (!is.na(data[timestamp][,
>   : missing value where TRUE/FALSE needed
> .....
>
> In fact I had tried demo("maCross") and demo("pair_trade"), and got the
> same error message. Is there anyone can tell me what is wrong. Thanks in
> advanced.
>
> PS: my quantstrat , blotter, FinanceInstruments, etc packages are the
> latest version from R-forge.

All of these demos work for me with current R-Forge code, so you'll need 
to provide more information if anyone is going to be able to help you.

Here's my sessionInfo()

 > sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
  [7] LC_PAPER=C                 LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] quantstrat_0.6.8          blotter_0.8.12
[3] FinancialInstrument_1.0.3 quantmod_0.3-17
[5] Defaults_1.1-1            TTR_0.20-3
[7] xts_0.8-6                 zoo_1.7-7

loaded via a namespace (and not attached):
[1] grid_2.15.1    lattice_0.20-6 tools_2.15.1




-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock



More information about the R-SIG-Finance mailing list