[R-SIG-Finance] Custom Indicator and apply.paramset problem

Atakan Okan atakanokan at outlook.com
Sat Feb 25 21:47:37 CET 2017


Thanks for the quick reply Brian,

The error reads as follows:

error calling combine function:
<simpleError in fun(result.1, result.2, result.3, result.4, result.5, result.6,     result.7, result.8, result.9, result.10, result.11, result.12,     result.13, result.14, result.15, result.16, result.17, result.18,     result.19, result.20, result.21, result.22, result.23, result.24): attempt to select less than one element in OneIndex>


After switching to doParallel, the error message stays the same. How should I export my custom function to the cluster workers using .exports though? Just add it as an argument to apply.paramset()? Took a quick look at the apply.paramset() source code but couldn't figure out how to pass the .exports argument to it.

Thanks,

Atakan

The new parallel code (all other bits are the same):

#DoParallel on Windows - Does Not Work 
library(doParallel)
library(parallel)
paramsetenv <- new.env()
cl <- makeCluster(detectCores())
registerDoParallel(cl, cores=detectCores())                                      
results <- apply.paramset(strategy.st,
                          paramset.label=paramset.label.name,
                          portfolio=strategy.st, 
                          account=strategy.st,
                          nsamples=0,
                          verbose = TRUE,
                          audit=paramsetenv,
                          calc = "slave")
stopCluster(cl) 
    


More information about the R-SIG-Finance mailing list