【发布时间】:2020-10-12 11:30:51
【问题描述】:
所以我在 Pine 编辑器上收到以下关于颜色的未声明标识符错误..
line 23: Undeclared identifier 'red';
line 24: Undeclared identifier 'blue';
line 25: Undeclared identifier 'white';
line 36: Undeclared identifier 'blue';
line 36: Undeclared identifier 'white';
line 50: Undeclared identifier 'red';
line 50: Undeclared identifier 'black'
这是我正在运行的代码。如您所见,我正在运行第 4 版。
//@version=4
study("Simple Trading", overlay = true)
ma5 = sma(close, 5)
ma10 = sma(close, 10)
ma30 = sma(close, 30)
src1 = input(close, title = "RSI Source")
rsil = input(14, minval = 1, title = "RSI Length")
rsi30 = input(30, minval = 1, title = "Buy w/RSI < ")
rsi70 = input(70, minval = 1, title = "Sell w/RSI > ")
src2 = input(close, title = "Stoch Source")
kdk = input(9, minval = 1, title = "Stoch K")
kdd = input(3, minval = 1, title = "Stoch D")
kds = input(3, minval = 1, title = "Stoch Smooth")
kd20 = input(20, minval = 1, title = "Buy w/STOCH <")
kd80 = input(80, minval = 1, title = "Sell w/STOCH >")
plot(ma5, color = red)
plot(ma10, color = blue)
plot(ma30, color = white)
//main------------------------------------
_falling = falling(ma30, 20)
fiveless = ma5 < ma30
tenless = ma10 < ma30
armbuy = fiveless and tenless and _falling
rsi = rsi(src1, rsil) < rsi30
greencandle = close > open and close[1] <= open[1] and close>close[1]
strongbuyhere = armbuy and rsi and greencandle
plotshape(strongbuyhere, style = shape.labelup, color = blue, location = location.belowbar, size = size.small, text = "Buy", textcolor = white)
alertcondition(strongbuyhere, title = "Strong Buy Position", message = "Buy")
plot(valuewhen(strongbuyhere, close, 0))
//reverse---------------------------------
r_falling = rising(ma30, 20)
rfiveless = ma5 > ma30
rtenless = ma10 > ma30
rarmbuy = rfiveless and rtenless and r_falling
rrsi = rsi(src1, rsil) > rsi70
rgreencandle = close < open and close[1] > open[1]
rstrongbuyhere = rarmbuy and rrsi and rgreencandle
plotshape(rstrongbuyhere, style = shape.labeldown, color = red, location = location.abovebar, size = size.small, text = "Sell", textcolor = black)
alertcondition(rstrongbuyhere, title = "Strong Sell Position", message = "Sell")
plot(valuewhen(rstrongbuyhere, close, 0))'''
有谁知道我该如何解决这个问题以及我做错了什么?
谢谢
【问题讨论】:
标签: pine-script algorithmic-trading tradingview-api