3

私のストラテジーにはロング ポジションしかありませんが、luxor-demo と同様の add.distribution ルールを適用しています。

戦略全体は機能しますが、パラメーターセットを適用すると、次のエラーが発生します。

テイクプロフィットロング 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つのアイテムにのみディストリビューションを適用する方法を助けることができますか?

よろしくお願いします!

編集 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 
4

1 に答える 1

1

これは#5776と同じバグです。「シグナル」コンポーネント タイプでは修正されましたが、「チェーン」では修正されませんでした。R-Forgeのリビジョン 1669 で修正されました。

于 2015-01-13T23:05:29.287 に答える