[英]Pine Language - Undeclared Identifier Error
這段代碼有什么問題? 我收到未聲明的標識符錯誤。 不明白為什么
// This is a simple moving average cross-over strategy
//@version=3
strategy("Crossover")
// Buy rule
entryLong = crossover(sma(10), sma(20))
if (entryLong)
strategy.entry("MyLong", strategy.long, qty=1, limit=10, stop=5)
// Sell rule
entryShort = crossunder(sma(10), sma(20))
if entryShort
strategy.entry("MyShort", strategy.short, qty=1, limit=10, stop=5)
您應該使用第 5 版的 pinescript,因為第 3 版顯然已經過時並且會產生難以發現的錯誤。
這是版本 5 中的代碼:
//@version=5
strategy("Crossover")
// Buy rule
entryLong = ta.crossover(ta.sma(close,10), ta.sma(close,20))
if (entryLong)
strategy.entry("MyLong", strategy.long, qty=1, limit=10, stop=5)
// Sell rule
entryShort = ta.crossunder(ta.sma(close,10), ta.sma(close,20))
if entryShort
strategy.entry("MyShort", strategy.short, qty=1, limit=10, stop=5)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.