SCM

SCM Repository

[blotter] Annotation of /pkg/quantstrat/demo/macdParameters.R
ViewVC logotype

Annotation of /pkg/quantstrat/demo/macdParameters.R

Parent Directory Parent Directory | Revision Log Revision Log


Revision 692 - (view) (download)
Original Path: pkg/quantstrat/demo/parameterTestMACD.R

1 : cyrforge 663 # TODO: Add comment
2 :     #
3 :     # Author: CCD
4 :     ###############################################################################
5 :    
6 : cyrforge 692 require(foreach)
7 :     require(doSMP)
8 :     workers <- startWorkers(2)
9 :     registerDoSMP(workers)
10 :    
11 :    
12 : cyrforge 687 source("D:\\Documents\\GoogleCode\\Workspace\\quantstrat\\R\\parameters.R")
13 : cyrforge 663
14 :     #please run macd demo before all these...
15 :     paramStructure<-getParameterTable(stratMACD)
16 :    
17 :     tPD2<-setParameterDistribution()
18 :     tPD2
19 :    
20 :     # Just provide leagal values and use random sampling.
21 :     tPD2<-setParameterDistribution(tPD2,'indicator',indexnum=1,distribution=list(nFast=(10:30)),label='nFast')
22 :     #make them over lap from 20 to 30 to test.
23 :     tPD2<-setParameterDistribution(tPD2,'indicator',indexnum=1,distribution=list(nSlow=(20:40)),label='nSlow')
24 :     tPD2<-setParameterDistribution(tPD2,'signal',indexnum=1,distribution=list(relationship=c('gt','gte')),label='sig1.gtgte')
25 :    
26 :     pConstraint2<-setParameterConstraint(constraintLabel='macdPC',paramList=c('nFast','nSlow'),relationship='lt')
27 :    
28 :    
29 :    
30 : cyrforge 687 #testPackList2<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=3,parameterConstrains=pConstraint2)
31 :     #system.time(testPackList2<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=3,parameterConstrains=pConstraint2))
32 :    
33 :    
34 : cyrforge 692 laststpar<-system.time(
35 :     testPackListPL<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=10,parameterConstrains=pConstraint2)
36 :     )
37 : cyrforge 687 laststpar
38 :     #
39 :     #stopWorkers(workers)
40 :     #rmSessions(all=TRUE)
41 :    
42 :    
43 :    
44 :    
45 :    

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge