dポイントプレゼントキャンペーン実施中!

trading view にて下記コードを作りました。これは、ゴールデンクロス、デッドクロスでエントリーして、利確、損切りを6pipsにしたものです。
indicator("マイスクリプト")
study("Golden/Dead Cross Strategy")

length = 10
fast_ma = sma(close, length)
slow_ma = sma(close, length * 2)

longCondition = crossover(fast_ma, slow_ma)
shortCondition = crossunder(fast_ma, slow_ma)

// Entry Rules
if (longCondition)
strategy.entry("Long", strategy.long)

if (shortCondition)
strategy.entry("Short", strategy.short)

// Exit Rules
strategy.exit("Long TP", "Long", profit = 6 * pip)
strategy.exit("Long SL", "Long", loss = 6 * pip)

strategy.exit("Short TP", "Short", profit = 6 * pip)
strategy.exit("Short SL", "Short", loss = 6 * pip)
plot(close)

そしてストラテジーテスターで、ストラテジー の読み込みをして、マイスクリプトを選ぶのですが、チャート上に、error:can not compile scriptとエラー表示されます。
どこがいけないのでしょうか?

A 回答 (1件)

まずは最小限のスクリプトで


動作確認とかしたら?
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!