Pine script TradingView{{close}}不适用于纯文本警报

Pine script TradingView{{close}}不适用于纯文本警报,pine-script,plaintext,alerts,Pine Script,Plaintext,Alerts,我想使这个机器人更有用,但有一些问题,我已经面临,我希望你能帮助我 代码是用纯文本编写的 我修改了下面的代码(只是添加了两行代码以创建警报) {{close}仅适用于@version=4 然而,一旦您将@version=4放在代码顶部,就会出现很多错误,因为@version=4无法识别某些代码。你必须把它们转换成@version=4 study(title="VET Bot", overlay = true) SOURCE = input(hlc3) RSILENGTH = input(14,

我想使这个机器人更有用,但有一些问题,我已经面临,我希望你能帮助我

代码是用纯文本编写的

我修改了下面的代码(只是添加了两行代码以创建警报)


{{close}
仅适用于
@version=4
然而,一旦您将
@version=4
放在代码顶部,就会出现很多错误,因为
@version=4
无法识别某些代码。你必须把它们转换成
@version=4

study(title="VET Bot", overlay = true)

SOURCE = input(hlc3)
RSILENGTH = input(14, title = "RSI LENGTH")
RSICENTERLINE = input(52, title = "RSI CENTER LINE")
MACDFASTLENGTH = input(7, title = "MACD FAST LENGTH")
MACDSLOWLENGTH = input(12, title = "MACD SLOW LENGTH")
MACDSIGNALSMOOTHING = input(12, title = "MACD SIGNAL SMOOTHING")

a = input(1, title = "Key Vaule")
SmoothK = input(3)
SmoothD = input(3)
LengthRSI = input(14)
LengthStoch = input(14)
RSISource = input(close) 
c = input(9, title="ATR Period")

xATR = atr(c)
nLoss = a * xATR
xATRTrailingStop = iff(close > nz(xATRTrailingStop[1], 0) and close[1] > nz(xATRTrailingStop[1], 0), max(nz(xATRTrailingStop[1]), close - nLoss),
                    iff(close < nz(xATRTrailingStop[1], 0) and close[1] < nz(xATRTrailingStop[1], 0), min(nz(xATRTrailingStop[1]), close + nLoss), 
                        iff(close > nz(xATRTrailingStop[1], 0), close - nLoss, close + nLoss)))
pos =   iff(close[1] < nz(xATRTrailingStop[1], 0) and close > nz(xATRTrailingStop[1], 0), 1,
        iff(close[1] > nz(xATRTrailingStop[1], 0) and close < nz(xATRTrailingStop[1], 0), -1, nz(pos[1], 0))) 

color = pos == -1 ? red: pos == 1 ? green : blue 
ema= ema(close,1)
above = crossover(ema,xATRTrailingStop )
below = crossover(xATRTrailingStop,ema)
buy = close > xATRTrailingStop and above 
sell = close < xATRTrailingStop and below
barbuy = close > xATRTrailingStop 
barsell = close < xATRTrailingStop 

alertcondition(buy, title='Al', message = 'Al')
alertcondition(sell, title='Sat', message = 'Sat')
plotshape(buy, title = "Al", text = 'Al', style = shape.labelup, location = location.belowbar, color= green,textcolor = white, transp = 0, size = size.tiny)
plotshape(sell, title = "Sat", text = 'Sat', style = shape.labeldown, location = location.abovebar, color= red,textcolor = white, transp = 0, size = size.tiny)

barcolor(barbuy? green:na)
barcolor(barsell? red:na)
alertcondition(buy, title='Al', message = 'Al @' + tostring(close))