我正在应用类似于luxor-demo的add.distribution规则,而我的策略只有很长的位置。
整个策略有效,但在应用参数时,我会收到以下错误:
TakeProfitLONG 47 0.047
TakeProfitLONG 47 0.047评估表达式的结果:
param.combo [[param.label]]中的simpleError:下标超出范围
获得任务47的结果numValues:47,numResults:47,停止:FALSE 返回状态FALSE评估#48:$ param.combo
我正在尝试在简单的takeProfit规则上运行分发(从stopLoss或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
)
我按如下方式添加分发:
add.distribution(strategy.st,
paramset.label = 'TakeProfit',
component.type = 'chain',
component.label = 'TakeProfitLONG',
variable = list(threshold = .TakeProfit),
label = 'TakeProfitLONG'
)
并应用集合:
results <- apply.paramset(strategy.st, paramset.label='TakeProfit', portfolio.st=portfolio.st, account.st=account.st, nsamples=.nsamples, verbose=TRUE)
从我有限的调试中看来,参数集似乎是一个简单的向量,而在apply.paramset中,后面的函数失败了:
results <- fe %dopar% { ... }
在这里,我对R来说太新了,因为我只有4周的时间来研究这个问题,但可能会打电话给:
install.param.combo <- function(strategy, param.combo, paramset.label)
可能会导致错误?
我必须为新的道歉,但是有没有人遇到过这个或者可以帮助如何在长期策略中仅将一个项目应用于一个项目?
非常感谢提前!
编辑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
答案 0 :(得分:1)
这与# 5776的错误相同。它固定为&#34;信号&#34;组件类型,但不适用于&#34;链&#34;。现在应该固定为revision 1669 on R-Forge。