SCM

SCM Repository

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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 692 - (download) (annotate)
Thu Jul 21 23:00:07 2011 UTC (8 years ago) by cyrforge
Original Path: pkg/quantstrat/demo/parameterTestMACD.R
File size: 1572 byte(s)
Miner changes for running parallel, example use doSMP.
# TODO: Add comment
# 
# Author: CCD
###############################################################################

require(foreach)
require(doSMP)
workers <- startWorkers(2)
registerDoSMP(workers)


source("D:\\Documents\\GoogleCode\\Workspace\\quantstrat\\R\\parameters.R")

#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)
#system.time(testPackList2<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=3,parameterConstrains=pConstraint2))


laststpar<-system.time(
		testPackListPL<-applyParameter(strategy=stratMACD,portfolios=portfolio.st,parameterPool=tPD2,method='random',sampleSize=10,parameterConstrains=pConstraint2)
)
laststpar
#
#stopWorkers(workers)
#rmSessions(all=TRUE)






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