How to apply long only add.distribution parameterset in quantStrat - simpleError in param.combo [[param.label]]

I apply a similar add.distribution rule as in luxor-demo, while my strategy is only long.

The whole strategy works, but when applying the parameter set I get the following error:

TakeProfitLONG 47 0.047

TakeProfitLONG 47 0.047 expression calculation result:

simpleError in param.combo [[param.label]]: index out of bounds

got results for task 47 numValues: 47, numResults: 47, stopped: FALSE return status FALSE evaluation # 48: $ param.combo

I'm trying to run a distro with a simple takeProfit rule (get the same result from stopLoss or trailingStop):

.use.takeProfit = TRUE
.takeprofit <- 2.0/100 # actual
.TakeProfit = seq(0.1, 4.8, length.out=48)/100 # parameter set for optimization

## take-profit
add.rule(strategy.st, name = 'ruleSignal',
         arguments=list(sigcol='signal.gt.zero' , sigval=TRUE,
                        replace=FALSE,
                        orderside='long',
                        ordertype='limit', 
                        tmult=TRUE, 
                        threshold=quote(.takeprofit),
                        TxnFees=.txnfees,
                        orderqty='all',
                        orderset='ocolong'
         ),
         type='chain', 
         parent='EnterLONG',
         label='TakeProfitLONG',
         enabled=.use.takeProfit
)

      

I add distribution like this:

add.distribution(strategy.st,
                 paramset.label = 'TakeProfit',
                 component.type = 'chain',
                 component.label = 'TakeProfitLONG',
                 variable = list(threshold = .TakeProfit),
                 label = 'TakeProfitLONG'
)

      

and apply a lot:

results <- apply.paramset(strategy.st, paramset.label='TakeProfit', portfolio.st=portfolio.st, account.st=account.st, nsamples=.nsamples, verbose=TRUE)

      

From my limited debugging, it seems that the parameter set is a simple vector, whereas in apply.paramset the following function does not work:

results <- fe %dopar% { ... }

      

Here I am too new to R since only 4 weeks looking at this, but maybe calling:

install.param.combo <- function(strategy, param.combo, paramset.label)

      

might cause an error?

We apologize for coming up with a new one, but did anyone come across this or could help how to apply a distro to only one element in a long term strategy?

Thank you very much in advance!

EDIT 1: SessionInfo ()

R version 3.1.2 (2014-10-31)
Platform: i486-pc-linux-gnu (32-bit)

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] lattice_0.20-29               iterators_1.0.7               downloader_0.3
 [4] quantstrat_0.9.1665           foreach_1.4.2                 blotter_0.9.1644
 [7] PerformanceAnalytics_1.4.3574 FinancialInstrument_1.2.0     quantmod_0.4-3
[11] TTR_0.22-0.1                  xts_0.9-7                     zoo_1.7-12

loaded via a namespace (and not attached):
[1] codetools_0.2-9 compiler_3.1.2  digest_0.6.7    grid_3.1.2      tools_3.1.2 

      

+3


source to share


1 answer


This is the same error as # 5776 . It was set for signal types but not for chain. It should now be fixed as version 1669 in R-Forge .



+1


source







All Articles