ボットMEMO Opening Range Breakoutを試す


Trading ViewでUKIさんの、(元祖)どてん君のストラテジーを作ってみました。

でもパラメータをいじってもUKIさんのテスト結果と一致しないんだよなぁ。

ストラテジーの説明 (オープニング レンジ ブレイクアウト)

・2時間足

・直前の5つの足の最高値と最安値を求め、最高値ー最安値でレンジ幅を計算。

・レンジ幅の移動平均をとる。(5日分 60)

・さらにkを掛ける。(1.6を仮定)

・始値から計算したレンジ幅より、一瞬でも上がれば、次の足でロング。下がれば、次の足でショート。

パラメータは移動平均の期間と、kの値の二つです。

実装してみて、よくわからないのは、「レンジの計算期間」というのは移動平均の計算期間のことなのか?


ソースコード

if のあとに適切なTabを挿入してください。

//@version=3
strategy("doten-kun", overlay=true)

// backtest data range
testStartYear = 2018
testStartMonth = 1
testStartDay = 20
testPeriodStart = timestamp(testStartYear,testStartMonth,testStartDay,0,0)
testStopYear = 2018
testStopMonth = 4
testStopDay = 1
testPeriodStop = timestamp(testStopYear,testStopMonth,testStopDay,0,0)

testPeriod() => time >= testPeriodStart and time <= testPeriodStop ? true : false

rangelength = 5
rangesma = input(60)
k = input(1.6)

hh = highest(high[2], rangelength)
ll = lowest(low[2], rangelength)

range = (sma(hh - ll,rangesma) / 2 ) * k

if testPeriod()
if (crossover(high[1], open[1] + range))
strategy.entry("LE", strategy.long, comment="LE")
if (crossunder(low[1], open[1] - range))
strategy.entry("SE", strategy.short, comment="SE")

plot(hh)
plot(ll)
plot(open+range, color=black)
plot(open-range, color=black)





この記事が気に入ったらサポートをしてみませんか?