[Blotter-commits] r1376 - pkg/quantstrat/demo
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Jan 22 00:41:11 CET 2013
Author: milktrader
Date: 2013-01-22 00:41:11 +0100 (Tue, 22 Jan 2013)
New Revision: 1376
Modified:
pkg/quantstrat/demo/bbandParameters.R
pkg/quantstrat/demo/bbands.R
pkg/quantstrat/demo/bee.R
pkg/quantstrat/demo/faber.R
pkg/quantstrat/demo/faberMC.R
pkg/quantstrat/demo/faber_rebal.R
pkg/quantstrat/demo/luxor-3.11.R
pkg/quantstrat/demo/luxor-3.12.R
pkg/quantstrat/demo/luxor-3.16.R
pkg/quantstrat/demo/luxor.1.R
pkg/quantstrat/demo/luxor.2.R
pkg/quantstrat/demo/luxor.3.Parameters.R
pkg/quantstrat/demo/luxor.3.Parameters.tradegraphs.R
pkg/quantstrat/demo/luxor.3.R
pkg/quantstrat/demo/luxor.4.R
pkg/quantstrat/demo/luxor.4.Timespans.R
pkg/quantstrat/demo/luxor.4.Timespans.tradegraphs.R
pkg/quantstrat/demo/luxor.StopLoss.R
pkg/quantstrat/demo/luxor.StopTrailing.R
pkg/quantstrat/demo/luxor.TakeProfit.R
pkg/quantstrat/demo/luxor.exits.R
pkg/quantstrat/demo/luxor.orderchains.R
pkg/quantstrat/demo/maCross.R
pkg/quantstrat/demo/macd.R
pkg/quantstrat/demo/macdRebalancing.R
pkg/quantstrat/demo/pair_trade.R
pkg/quantstrat/demo/rocema.R
pkg/quantstrat/demo/rsi.R
Log:
stubbed new in_test blocks
Modified: pkg/quantstrat/demo/bbandParameters.R
===================================================================
--- pkg/quantstrat/demo/bbandParameters.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/bbandParameters.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -68,13 +68,6 @@
print(testPackList$statsTable)
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
-
##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
# book = getOrderBook(port)
# stats = tradeStats(port)
Modified: pkg/quantstrat/demo/bbands.R
===================================================================
--- pkg/quantstrat/demo/bbands.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/bbands.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -14,12 +14,16 @@
currency('USD')
stock(stock.str,currency='USD',multiplier=1)
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate='2006-12-31'
initEq=1000000
Modified: pkg/quantstrat/demo/bee.R
===================================================================
--- pkg/quantstrat/demo/bee.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/bee.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -4,28 +4,31 @@
# copyright (c) 2009-2012, Algorithm Alpha, LLC
# Licensed GPL-2
#
+##### PLACE DEMO AND TEST DATES HERE #################
+
+if(isTRUE(options('in_test')$in_test))
+ # use test dates
+ {initDate="2011-01-01"
+ endDate="2012-12-31"
+ } else
+ # use demo defaults
+ {initDate="1999-12-31"
+ endDate=Sys.Date()}
+
############################# DEFINE VARIABLES ##############################
sym = 'GLD'
port = 'bug'
acct = 'colony'
initEq = 100000
-initDate = '1999-12-31'
fast = 10
slow = 30
sd = 0.5
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-if(!exists('in_test') || !isTRUE(in_test)){
- initDate="2000-01-01" # ensure this is demo default
- endDate=Sys.Date() # ensure this is demo default
-}
-################################################################
-
############################# GET DATA ######################################
suppressMessages(require(quantstrat))
-getSymbols(sym, from=initDate, to=Sys.Date(), index.class=c("POSIXt","POSIXct"))
+getSymbols(sym, from=initDate, to=endDate, index.class=c("POSIXt","POSIXct"))
############################# INITIALIZE ####################################
Modified: pkg/quantstrat/demo/faber.R
===================================================================
--- pkg/quantstrat/demo/faber.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/faber.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -51,12 +51,16 @@
"GSPC", "stratFaber", "initDate", "initEq", "Posn", "UnitSize", "verbose"))
suppressWarnings(rm("order_book.faber",pos=.strategy))
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
# Set initial values
initDate='1997-12-31'
Modified: pkg/quantstrat/demo/faberMC.R
===================================================================
--- pkg/quantstrat/demo/faberMC.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/faberMC.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -51,12 +51,16 @@
suppressWarnings(rm("ltaccount","ltportfolio","ClosePrice","CurrentDate","equity","stratFaber","initDate","initEq","Posn","UnitSize","verbose"))
suppressWarnings(rm("order_book.faber","order_book.combMC", "order_book.GDAXI", "order_book.GSPC", "order_book.N225", pos=.strategy))
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
# Set initial values
initDate='2000-01-01'
Modified: pkg/quantstrat/demo/faber_rebal.R
===================================================================
--- pkg/quantstrat/demo/faber_rebal.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/faber_rebal.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -51,12 +51,16 @@
"GSPC", "stratFaber", "initDate", "initEq", "Posn", "UnitSize", "verbose"))
suppressWarnings(rm("order_book.faber",pos=.strategy))
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
# Set initial values
initDate='1997-12-31'
Modified: pkg/quantstrat/demo/luxor-3.11.R
===================================================================
--- pkg/quantstrat/demo/luxor-3.11.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor-3.11.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -17,12 +17,16 @@
chart.ME('luxor', 'GBPUSD', type='MAE', scale='cash')
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
# book = getOrderBook(port)
Modified: pkg/quantstrat/demo/luxor-3.12.R
===================================================================
--- pkg/quantstrat/demo/luxor-3.12.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor-3.12.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -17,12 +17,16 @@
chart.ME('luxor', type='MAE', scale='percent')
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
# book = getOrderBook(port)
Modified: pkg/quantstrat/demo/luxor-3.16.R
===================================================================
--- pkg/quantstrat/demo/luxor-3.16.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor-3.16.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -17,12 +17,16 @@
chart.ME('luxor', type='MFE', scale='percent')
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
# book = getOrderBook(port)
Modified: pkg/quantstrat/demo/luxor.1.R
===================================================================
--- pkg/quantstrat/demo/luxor.1.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.1.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -18,12 +18,16 @@
.th=0.0005
.txn=0
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate = '2002-10-21'
.from='2002-10-21'
Modified: pkg/quantstrat/demo/luxor.2.R
===================================================================
--- pkg/quantstrat/demo/luxor.2.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.2.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -18,12 +18,16 @@
.th=0.0005
.txn=-30
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate = '2002-10-21'
.from='2002-10-21'
Modified: pkg/quantstrat/demo/luxor.3.Parameters.R
===================================================================
--- pkg/quantstrat/demo/luxor.3.Parameters.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.3.Parameters.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -85,13 +85,18 @@
stats <- scan.results$statsTable
save(stats, file="luxor.parameters.RData")
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
+
##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
# book = getOrderBook(port)
# stats = tradeStats(port)
Modified: pkg/quantstrat/demo/luxor.3.Parameters.tradegraphs.R
===================================================================
--- pkg/quantstrat/demo/luxor.3.Parameters.tradegraphs.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.3.Parameters.tradegraphs.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -12,12 +12,16 @@
title = 'Luxor SMA Parameter Scan'
)
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
# book = getOrderBook(port)
Modified: pkg/quantstrat/demo/luxor.3.R
===================================================================
--- pkg/quantstrat/demo/luxor.3.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.3.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -18,12 +18,16 @@
.th=0.0005
.txn=-30
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate = '2002-10-21'
.from='2002-10-21'
Modified: pkg/quantstrat/demo/luxor.4.R
===================================================================
--- pkg/quantstrat/demo/luxor.4.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.4.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -19,12 +19,16 @@
.txn=-30
.timespan = 'T08:00/T12:00'
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate = '2002-10-21'
.from='2002-10-21'
Modified: pkg/quantstrat/demo/luxor.4.Timespans.R
===================================================================
--- pkg/quantstrat/demo/luxor.4.Timespans.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.4.Timespans.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -84,12 +84,16 @@
stats <- scan.results$statsTable
save(stats, file="luxor.timespan.RData")
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
# book = getOrderBook(port)
Modified: pkg/quantstrat/demo/luxor.4.Timespans.tradegraphs.R
===================================================================
--- pkg/quantstrat/demo/luxor.4.Timespans.tradegraphs.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.4.Timespans.tradegraphs.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -25,12 +25,16 @@
title = 'Luxor Intraday TimeWindow Scan'
)
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
# book = getOrderBook(port)
Modified: pkg/quantstrat/demo/luxor.StopLoss.R
===================================================================
--- pkg/quantstrat/demo/luxor.StopLoss.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.StopLoss.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -22,13 +22,18 @@
.th=0.0005
.txn=0
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
+
initDate = '2002-10-21'
.from='2002-10-21'
#.to='2008-07-04'
Modified: pkg/quantstrat/demo/luxor.StopTrailing.R
===================================================================
--- pkg/quantstrat/demo/luxor.StopTrailing.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.StopTrailing.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -22,12 +22,16 @@
.th=0.0005
.txn=0
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate = '2002-10-21'
.from='2002-10-21'
Modified: pkg/quantstrat/demo/luxor.TakeProfit.R
===================================================================
--- pkg/quantstrat/demo/luxor.TakeProfit.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.TakeProfit.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -22,12 +22,16 @@
.th=0.0005
.txn=0
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate = '2002-10-21'
.from='2002-10-21'
Modified: pkg/quantstrat/demo/luxor.exits.R
===================================================================
--- pkg/quantstrat/demo/luxor.exits.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.exits.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -4,12 +4,16 @@
source('luxor.strategy.R')
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
.FastSMA = (1:20)
.SlowSMA = (30:80)
Modified: pkg/quantstrat/demo/luxor.orderchains.R
===================================================================
--- pkg/quantstrat/demo/luxor.orderchains.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/luxor.orderchains.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -23,12 +23,16 @@
.stoptrailing=0.0015
.takeprofit=0.003
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate = '2002-10-21'
.from='2002-10-21'
Modified: pkg/quantstrat/demo/maCross.R
===================================================================
--- pkg/quantstrat/demo/maCross.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/maCross.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -20,19 +20,17 @@
currency('USD')
stock(stock.str,currency='USD',multiplier=1)
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
-#specify initDate and endDate if we're not inside the test wrappers
-if(!exists('in_test') || !isTRUE(in_test)){
- initDate='2005-12-31'
- endDate=Sys.Date()
-}
-
initEq=1000000
portfolio.st='macross'
account.st='macross'
Modified: pkg/quantstrat/demo/macd.R
===================================================================
--- pkg/quantstrat/demo/macd.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/macd.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -31,12 +31,16 @@
#data(sample_matrix) # data included in package xts
#sample_matrix<-as.xts(sample_matrix)
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate='2006-12-31'
initEq=1000000
Modified: pkg/quantstrat/demo/macdRebalancing.R
===================================================================
--- pkg/quantstrat/demo/macdRebalancing.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/macdRebalancing.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -31,12 +31,16 @@
#data(sample_matrix) # data included in package xts
#sample_matrix<-as.xts(sample_matrix)
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate='2006-12-31'
initEq=1000000
Modified: pkg/quantstrat/demo/pair_trade.R
===================================================================
--- pkg/quantstrat/demo/pair_trade.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/pair_trade.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -24,13 +24,19 @@
require(quantstrat)
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
+
initDate = '2009-01-01'
endDate = '2011-05-01'
startDate = '2009-01-02'
Modified: pkg/quantstrat/demo/rocema.R
===================================================================
--- pkg/quantstrat/demo/rocema.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/rocema.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -226,6 +226,17 @@
cat('Net profit:', sum(txns$Net.Txn.Realized.PL), '\n')
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
+
##### PLACE THIS BLOCK AT END OF DEMO SCRIPT ###################
# book = getOrderBook(port)
# stats = tradeStats(port)
Modified: pkg/quantstrat/demo/rsi.R
===================================================================
--- pkg/quantstrat/demo/rsi.R 2013-01-21 23:20:44 UTC (rev 1375)
+++ pkg/quantstrat/demo/rsi.R 2013-01-21 23:41:11 UTC (rev 1376)
@@ -46,12 +46,16 @@
# you can test with something like this:
# applySignals(strategy=stratRSI, mktdata=applyIndicators(strategy=stratRSI, mktdata=symbols[1]))
-##### PLACE THIS BLOCK AHEAD OF DATE INITS IN DEMO SCRIPT ######
-# if(!exists('in_test') || !isTRUE(in_test)){
-# initDate='2005-12-31' # ensure this is demo default
-# endDate=Sys.Date() # ensure this is demo default
-# }
-################################################################
+##### PLACE DEMO AND TEST DATES HERE #################
+#
+#if(isTRUE(options('in_test')$in_test))
+# # use test dates
+# {initDate="2011-01-01"
+# endDate="2012-12-31"
+# } else
+# # use demo defaults
+# {initDate="1999-12-31"
+# endDate=Sys.Date()}
initDate='1997-12-31'
initEq=100000
More information about the Blotter-commits
mailing list