📊 KabuLink バックテスト

戦略一覧 参考成績 ← KabuLink に戻る

Bollinger Bands 設定ガイド

 ·  SPY  ·  手数料 0.100%

① Pine Script(TradingViewに貼り付け)

TradingViewのパインエディタに以下のコードを貼り付けて戦略を追加してください。
commission_value = 0.100% がバックテストと同じ手数料条件で設定されています。
アラート作成時に Webhook URL に KabuLink の Webhook URL を、 メッセージstrategy.entry / strategy.closealert_message が自動で使用されます。

//@version=5
strategy("Bollinger Bands [W20 S2.0]", overlay=true,
     commission_type   = strategy.commission.percent,
     commission_value  = 0.1,
     initial_capital   = 1000000,
     default_qty_type  = strategy.fixed,
     default_qty_value = 1)

bbLength = input.int(20,    "BB Period")
bbMult   = input.float(2.0, "BB StdDev Multiplier")

[upperBand, middleBand, lowerBand] = ta.bb(close, bbLength, bbMult)

plot(upperBand,  "Upper",  color.red,    linewidth=1)
plot(middleBand, "Middle", color.gray,   linewidth=1)
plot(lowerBand,  "Lower",  color.green,  linewidth=1)

longEntry = ta.crossover(close, lowerBand)
longExit  = ta.crossunder(close, middleBand)

buyMsg  = '{"symbol": "{{ticker}}", "side": "buy",  "quantity": 1, "order_type": "market", "signal_time": "{{timenow}}"}'
sellMsg = '{"symbol": "{{ticker}}", "side": "sell", "quantity": 1, "order_type": "market", "signal_time": "{{timenow}}"}'

if longEntry
    strategy.entry("Long", strategy.long, alert_message=buyMsg)
if longExit
    strategy.close("Long", alert_message=sellMsg)

② KabuLinkで自動トレードを始める

KabuLink に登録してブローカーを接続すると、TradingView のアラートが自動的に発注されます。

KabuLinkに登録する →   ← 戦略一覧に戻る