> stock(stock.str, currency="USD",multiplier=1) [1] "GOOG" > #use paste with ^ to get index data > getSymbols(stock.str,from=initDate) [1] "GOOG" > > start_t<-Sys.time() > out<-try(applyStrategy(strategy='s' , portfolios='bbands')) [1] "2009-03-04 GOOG 10 @ 318.92" [1] "2009-03-09 GOOG 10 @ 290.89" [1] "2009-04-16 GOOG -10 @ 388.74" [1] "2009-05-28 GOOG -10 @ 410.4" [1] "2009-07-07 GOOG 10 @ 396.63" [1] "2009-07-15 GOOG -10 @ 438.17" [1] "2010-01-22 GOOG 10 @ 550.01" [1] "2010-03-04 GOOG -10 @ 554.59" [1] "2010-04-26 GOOG 10 @ 531.64" [1] "2010-05-04 GOOG 10 @ 506.37" [1] "2010-05-20 GOOG 10 @ 475.01" [1] "2010-06-29 GOOG 10 @ 454.26" [1] "2010-08-04 GOOG -10 @ 506.32" [1] "2010-08-19 GOOG 10 @ 467.97" [1] "2010-09-17 GOOG -10 @ 490.15" [1] "2010-09-24 GOOG -10 @ 527.29" [1] "2010-10-15 GOOG -10 @ 601.45" [1] "2010-11-12 GOOG 10 @ 603.29" [1] "2010-11-30 GOOG 10 @ 555.71" [1] "2011-01-05 GOOG -10 @ 609.07" [1] "2011-01-14 GOOG -10 @ 624.18" [1] "2011-03-01 GOOG 10 @ 600.76" [1] "2011-03-07 GOOG 10 @ 591.66" [1] "2011-03-10 GOOG 10 @ 580.3" [1] "2011-03-16 GOOG 10 @ 557.1" [1] "2011-04-15 GOOG 10 @ 530.7" [1] "2011-05-16 GOOG 10 @ 518.42" [1] "2011-05-23 GOOG 10 @ 518.39" [1] "2011-06-10 GOOG 10 @ 509.51" [1] "2011-06-15 GOOG 10 @ 502.95" [1] "2011-07-05 GOOG -10 @ 532.44" [1] "2011-07-15 GOOG -10 @ 597.62" [1] "2011-08-18 GOOG 10 @ 504.88" > # look at the order book > png("/tmp/backtest-GOOG.png",1200,800) > end_t<-Sys.time() > end_t-start_t Time difference of 47.82402 secs > updatePortf(Portfolio='bbands',Dates=paste('::',as.Date(Sys.time()),sep='')) [1] "bbands" > chart.Posn(Portfolio='bbands',Symbol=stock.str) > plot(add_BBands(on=1,sd=SD,n=N)) > getOrderBook('bbands') $bbands $bbands$GOOG Order.Qty Order.Price Order.Type Order.Side Order.Threshold 2009-01-31 "0" NA "init" "long" "0" 2009-03-04 "10" "318.92" "market" "long" NA 2009-03-09 "10" "290.89" "market" "long" NA 2009-04-16 "-10" "388.74" "market" "long" NA 2009-05-28 "-10" "410.4" "market" "long" NA 2009-07-07 "10" "396.63" "market" "long" NA 2009-07-15 "-10" "438.17" "market" "long" NA 2010-01-22 "10" "550.01" "market" "long" NA 2010-03-04 "-10" "554.59" "market" "long" NA 2010-04-26 "10" "531.64" "market" "long" NA 2010-05-04 "10" "506.37" "market" "long" NA 2010-05-20 "10" "475.01" "market" "long" NA 2010-06-29 "10" "454.26" "market" "long" NA 2010-08-04 "-10" "506.32" "market" "long" NA 2010-08-19 "10" "467.97" "market" "long" NA 2010-09-17 "-10" "490.15" "market" "long" NA 2010-09-24 "-10" "527.29" "market" "long" NA 2010-10-15 "-10" "601.45" "market" "long" NA 2010-11-12 "10" "603.29" "market" "long" NA 2010-11-30 "10" "555.71" "market" "long" NA 2011-01-05 "-10" "609.07" "market" "long" NA 2011-01-14 "-10" "624.18" "market" "long" NA 2011-03-01 "10" "600.76" "market" "long" NA 2011-03-07 "10" "591.66" "market" "long" NA 2011-03-10 "10" "580.3" "market" "long" NA 2011-03-16 "10" "557.1" "market" "long" NA 2011-04-15 "10" "530.7" "market" "long" NA 2011-05-16 "10" "518.42" "market" "long" NA 2011-05-23 "10" "518.39" "market" "long" NA 2011-06-10 "10" "509.51" "market" "long" NA 2011-06-15 "10" "502.95" "market" "long" NA 2011-07-05 "-10" "532.44" "market" "long" NA 2011-07-15 "-10" "597.62" "market" "long" NA 2011-08-18 "10" "504.88" "market" "long" NA Order.Status Order.StatusTime Order.Set Txn.Fees 2009-01-31 "closed" "2009-01-31" "1" "0" 2009-03-04 "closed" "2009-03-05" NA "0" 2009-03-09 "closed" "2009-03-10" NA "0" 2009-04-16 "closed" "2009-04-17" NA "0" 2009-05-28 "closed" "2009-05-29" NA "0" 2009-07-07 "closed" "2009-07-08" NA "0" 2009-07-15 "closed" "2009-07-16" NA "0" 2010-01-22 "closed" "2010-01-25" NA "0" 2010-03-04 "closed" "2010-03-05" NA "0" 2010-04-26 "closed" "2010-04-27" NA "0" 2010-05-04 "closed" "2010-05-05" NA "0" 2010-05-20 "closed" "2010-05-21" NA "0" 2010-06-29 "closed" "2010-06-30" NA "0" 2010-08-04 "closed" "2010-08-05" NA "0" 2010-08-19 "closed" "2010-08-20" NA "0" 2010-09-17 "closed" "2010-09-20" NA "0" 2010-09-24 "closed" "2010-09-27" NA "0" 2010-10-15 "closed" "2010-10-18" NA "0" 2010-11-12 "closed" "2010-11-15" NA "0" 2010-11-30 "closed" "2010-12-01" NA "0" 2011-01-05 "closed" "2011-01-06" NA "0" 2011-01-14 "closed" "2011-01-18" NA "0" 2011-03-01 "closed" "2011-03-02" NA "0" 2011-03-07 "closed" "2011-03-08" NA "0" 2011-03-10 "closed" "2011-03-11" NA "0" 2011-03-16 "closed" "2011-03-17" NA "0" 2011-04-15 "closed" "2011-04-18" NA "0" 2011-05-16 "closed" "2011-05-17" NA "0" 2011-05-23 "closed" "2011-05-24" NA "0" 2011-06-10 "closed" "2011-06-13" NA "0" 2011-06-15 "closed" "2011-06-16" NA "0" 2011-07-05 "closed" "2011-07-06" NA "0" 2011-07-15 "closed" "2011-07-18" NA "0" 2011-08-18 "closed" "2011-08-19" NA "0" attr(,"class") [1] "order_book" > tradeStats('bbands')[,c('Num.Trades')] [1] 33 > faber.stats<-tradeStats("bbands")[,c("Symbol","Num.Trades","Net.Trading.PL","maxDrawdown")] > faber.stats Symbol Num.Trades Net.Trading.PL maxDrawdown GOOG GOOG 33 6351.7 -10667.6
Mittwoch, 21. September 2011
backtesting
Abonnieren
Posts (Atom)