3

I am applying similar add.distribution rule as in the luxor-demo while my strategy has only a long position.

The whole strategy works, but when applying a parameterset I get following error:

TakeProfitLONG 47 0.047

TakeProfitLONG 47 0.047 result of evaluating expression:

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

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

I am trying to run a distribution on a simple takeProfit rule (get 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 am adding the distribution as follows:

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

and apply the set:

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 parameterset is a simple vector whereas in the apply.paramset following function fails:

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

Here I am too new to R as i am only 4 weeks looking into this, but possibly a call to:

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

might cause the error?

Have to apologize as I am to new, but did anyone encounter this or could help how to apply a distribution to only one item in a long only strategy?

Many thanks 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 
Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418
Aylon
  • 65
  • 5
  • This looks similar to [bug #5776](https://r-forge.r-project.org/tracker/index.php?func=detail&aid=5776&group_id=316&atid=1269). Please add the output from `sessionInfo()` to your question. – Joshua Ulrich Jan 13 '15 at 03:47
  • Hi Joshua. Thanks for the reply and it seems to be related to the bug [#5776](https://r-forge.r-project.org/tracker/index.php?func=detail&aid=5776&group_id=316&atid=1269) although i did not get any valid output with a single parameter - just the "simpleError" message in the question title. Using two parameters seems to work fine. Was so focused on getting at least one parameter running that I never thought of fully replicating the example with two parameters. – Aylon Jan 13 '15 at 22:29

1 Answers1

1

This is the same bug as # 5776. It was fixed for "signal" component types, but not for "chain". It should now be fixed as of revision 1669 on R-Forge.

Joshua Ulrich
  • 173,410
  • 32
  • 338
  • 418