[Blotter-commits] r272 - pkg/quantstrat/demo

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Feb 26 18:35:22 CET 2010


Author: braverock
Date: 2010-02-26 18:35:22 +0100 (Fri, 26 Feb 2010)
New Revision: 272

Modified:
   pkg/quantstrat/demo/BBands.R
Log:
- update names to 'bbands' for this demo

Modified: pkg/quantstrat/demo/BBands.R
===================================================================
--- pkg/quantstrat/demo/BBands.R	2010-02-26 15:08:19 UTC (rev 271)
+++ pkg/quantstrat/demo/BBands.R	2010-02-26 17:35:22 UTC (rev 272)
@@ -1,6 +1,6 @@
 require(quantstrat)
-try(rm("order_book.simplestrat",pos=.strategy),silent=TRUE)
-try(rm("account.simplestrat","portfolio.simplestrat",pos=.blotter),silent=TRUE)
+try(rm("order_book.bbands",pos=.strategy),silent=TRUE)
+try(rm("account.bbands","portfolio.bbands",pos=.blotter),silent=TRUE)
 try(rm("account.st","portfolio.st","IBM","s","initDate","initEq",'start_t','end_t'),silent=TRUE)
 
 currency('USD')
@@ -9,14 +9,14 @@
 initDate='1997-12-31'
 initEq=1000000
 
-portfolio.st='simplestrat'
-account.st='simplestrat'
+portfolio.st='bbands'
+account.st='bbands'
 
 initPortf(portfolio.st,symbols='IBM', initDate=initDate)
-initAcct(account.st,portfolios='simplestrat', initDate=initDate)
+initAcct(account.st,portfolios='bbands', initDate=initDate)
 initOrders(portfolio=portfolio.st,initDate=initDate)
 
-s <- strategy("simplestrat")
+s <- strategy("bbands")
 #s <- add.indicator(strategy = s, name = "SMA", arguments = list(x = quote(Cl(mktdata)), n=10), label="SMA10")
 s <- add.indicator(strategy = s, name = "BBands", arguments = list(HLC = quote(HLC(mktdata)), sd = 2, n=20, maType=quote(SMA)))
 
@@ -40,13 +40,13 @@
 
 getSymbols("IBM")
 start_t<-Sys.time()
-out<-try(applyStrategy(strategy='s' , portfolios='simplestrat'))
+out<-try(applyStrategy(strategy='s' , portfolios='bbands'))
 # look at the order book
-#getOrderBook('simplestrat')
+#getOrderBook('bbands')
 end_t<-Sys.time()
 end_t-start_t
-updatePortf(Portfolio='simplestrat',Dates=paste('::',as.Date(Sys.time()),sep=''))
-chart.Posn(Portfolio='simplestrat',Symbol='IBM',theme='white')
+updatePortf(Portfolio='bbands',Dates=paste('::',as.Date(Sys.time()),sep=''))
+chart.Posn(Portfolio='bbands',Symbol='IBM',theme='white')
 plot(addBBands(on=1,sd=2,n=20))
 ###############################################################################
 # R (http://r-project.org/) Quantitative Strategy Model Framework



More information about the Blotter-commits mailing list