Customizing Backtest
拡張キットに自動売買検証を定義するには以下のようになります。バージョン1.1で、資金量を設定したり多数のシグナルが同時に検出されたときの選択ルールを設定できるようになりました。
<autotrading id="rsi_min_max" title="RSI $a 買い - $b 売り" longshort="long" maxDayCount="100" maxDayCountAction="ignore" initialCash="10000000" misconfigTradeRule="precedeResult"> <parameterDescription>$unit数 $len, 買いライン $a, 売りライン $b</parameterDescription> <entry type="TodayClose"> <condition>rsi(this, $len)*100 < $a</condition> </entry> <exit type="TodayClose"> <condition>rsi(this, $len)*100 > $b</condition> </exit> <losscut type="TodayClose"> <condition>close() < entry() * 0.95</condition> </losscut> <parameter id="len" initial="14"/><parameter id="a" initial="30"/><parameter id="b" initial="70"/> <entryColumn label="25日移動平均乖離" format="+%.2"> <expression>close()/ma(25) - 1</expression> </entryColumn> <exitColumn label="25日移動平均乖離" format="+%.2"> <expression>close()/ma(25) - 1</expression> </exitColumn> <signalSelector minCashAllocation="1" maxCashAllocation="10" limitCount="5" order="descending"> <sortExpression>close()</sortExpression> </signalSelector> </autotrading>
TodayClose | 当日の終値 |
TomorrowOpen | 翌日の始値 |
Sashine | 翌日に指値 |
Gyakusashine | 翌日に逆指値 |
Yorisashi | 翌日に寄指 |
指値、逆指値、寄指の場合にはいくらの指定なのかをするためにsashineエレメントが必要になります。指値をした結果翌日の値動きによって約定しない場合はシグナルは無視されます。
利益確定・ロスカット条件をTodayCloseにした場合、条件判定はエントリーした当日から行われます。従って、当日終値で手じまいする場合に限りデイトレードの検証も可能になります。
資金量の最小値・最大値はいくつか例をあげて説明します。
例1 上限10%+下限0%の設定で、5銘柄がヒットした場合、その5銘柄に10%ずつ分配し、残りの50%の資金は温存します。配分割合は総資産に対する割合ですが、実際にエントリーするには現金がなければいけないことに注意が必要です。他の銘柄に資金が拘束されていれば当然売買はできません。また、この条件に従って配分する資金が決まったあと、取引する株数は単位株数の整数倍になるように決まります。
(C) 2010 Lagarto Technology, Inc. All rights reserved.