[R] QUANSTRAT: error with applySignal

mayouf.k mayouf.k at gmail.com
Wed Aug 31 11:15:10 CEST 2011


hi everyone,

I want to backtest a simple strategy with RSI, im using "sigThreshold".

i took example from the http://blog.fosstrading.com/ site to understand how
quanstrat works.

but now, i have a problem with my code that i really don't understand, R
says me: 

Error in match.names(column, colnames(data)) : 
  argument "column" is missing, with no default

please can someone tell me what is wrong with code: 

require(quantstrat)
require(blotter)
require(PerformanceAnalytics)

# test de backtest quantstrat sur la strategie de daniel

         symbols <- "IEF"
         getSymbols(symbols, from=initDate, to=endDate,
index.class=c("POSIXt","POSIXct"))


          
          
          # Delete portfolio, account, and order book if they already exist
         
suppressWarnings(rm("account.daniel","portfolio.daniel",pos=.blotter))
          suppressWarnings(rm("order_book.daniel",pos=.strategy))
                   
                    # initialise du portefeuille
         
initPortf("daniel",symbol="IEF",initDate=periodicity(IEF)$start,currency('EUR'))
          
                    # initialise le compte
          initAcct("daniel",
portfolios="daniel",initDate=periodicity(IEF)$start)

                    # on initialise les ordres
          initOrders(portfolio="daniel",initDate=periodicity(IEF)$start)

                    # on construit un objet de type strategy
          s=strategy("intraday")
             
                   # on initialise un indicateur technique, (les arguments
sont en format list)
          s=
add.indicator(strategy=s,name="RSI",arguments=list(price=quote(Cl(IEF)),n=21),label="RSI21") 
          
                  # on defini les 2 signals,,
          s=add.signal(s,name="sigThreshold" ,arguments=list(data=IEF ,
columns="RSI21",threshold=70,relationship="lt",cross=TRUE ),label="entre")
          s=add.signal(s,name="sigThreshold" ,arguments=list(data=IEF ,
columns="RSI21",threshold=40,relationship="lt",cross=TRUE ),label="sortie" )


                 # on deifinit les regles
          s=add.rule(s,name="ruleSignal",arguments=list(sigcol="entre" 
,sigval=TRUE, orderqty=10    , ordertype="market" ,
orderside=NULL),type="enter")
          s=add.rule(s,name="ruleSignal",arguments=list(sigcol="sortie"
,sigval=TRUE, orderqty="all" , ordertype="market" ,
orderside=NULL),type="exit" )
          
          out <- try(applyStrategy(strategy=s, portfolios="daniel"))


thanks in advance


--
View this message in context: http://r.789695.n4.nabble.com/QUANSTRAT-error-with-applySignal-tp3780557p3780557.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list