📊 KabuLink バックテスト

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

SMA Crossover 設定ガイド

 ·  SPY  ·  手数料 0.100%

① Pine Script(TradingViewに貼り付け)

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

//@version=5
strategy("SMA Crossover [10/50]", overlay=true,
     commission_type   = strategy.commission.percent,
     commission_value  = 0.1,
     initial_capital   = 1000000,
     default_qty_type  = strategy.fixed,
     default_qty_value = 1)

fastLen = input.int(10, "Fast SMA Period")
slowLen = input.int(50, "Slow SMA Period")

fastMA = ta.sma(close, fastLen)
slowMA = ta.sma(close, slowLen)

plot(fastMA, "Fast", color.blue)
plot(slowMA, "Slow", color.orange)

longEntry = ta.crossover(fastMA, slowMA)
longExit  = ta.crossunder(fastMA, slowMA)

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に登録する →   ← 戦略一覧に戻る