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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Jul 8 03:01:52 CEST 2011


Author: cyrforge
Date: 2011-07-08 03:01:52 +0200 (Fri, 08 Jul 2011)
New Revision: 663

Added:
   pkg/quantstrat/demo/parameterTestMACD.R
Log:
Demo, run after macd.R. 
Used to test parameter constraints filter in parameter sample generating.

Added: pkg/quantstrat/demo/parameterTestMACD.R
===================================================================
--- pkg/quantstrat/demo/parameterTestMACD.R	                        (rev 0)
+++ pkg/quantstrat/demo/parameterTestMACD.R	2011-07-08 01:01:52 UTC (rev 663)
@@ -0,0 +1,24 @@
+# TODO: Add comment
+# 
+# Author: CCD
+###############################################################################
+
+
+
+#please run macd demo before all these...
+paramStructure<-getParameterTable(stratMACD)
+
+tPD2<-setParameterDistribution() 
+tPD2
+
+# Just provide leagal values and use random sampling.
+tPD2<-setParameterDistribution(tPD2,'indicator',indexnum=1,distribution=list(nFast=(10:30)),label='nFast')
+#make them over lap from 20 to 30 to test.
+tPD2<-setParameterDistribution(tPD2,'indicator',indexnum=1,distribution=list(nSlow=(20:40)),label='nSlow')
+tPD2<-setParameterDistribution(tPD2,'signal',indexnum=1,distribution=list(relationship=c('gt','gte')),label='sig1.gtgte')
+
+pConstraint2<-setParameterConstraint(constraintLabel='macdPC',paramList=c('nFast','nSlow'),relationship='lt')
+
+testPackList2<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=3,parameterConstrains=pConstraint2)
+
+



More information about the Blotter-commits mailing list