Pine-脚本/交易视图无法获得正确的代码来获得高+缓冲值



我正在尝试使用Pine脚本执行一个策略,其中以下条件应该匹配,并且应该执行一个long:

条件:发生交叉(ema10,ema20(和(交叉的高电平+缓冲区((ema10、ema20((。我无法获得长条目,你能帮忙解决这个问题吗?

以下是我的相同代码:

study("Crossover and highcrossover", overlay=true)
ema10 = ema(close, 10)
ema20 = ema(close, 20)
psar = sar(0.02,0.02,.2)
crossoverval = crossover(ema10, ema20)
signalhigh = iff(crossoverval == 1, high, na)
highbufferadd = signalhigh + 3.0
plot(signalhigh, title="signalhigh", color = green, linewidth = 1, transp=1)
plot(highbufferadd, title="highbufferadd", color = yellow, linewidth = 1, transp=1)
longentry = crossoverval and (close > highbufferadd)

plotshape(series=crossoverval, title="Crossover", style=shape.arrowup, location=location.belowbar, color=green, text="Crossover", size=size.small)
plotshape(series=longentry, title="longentry", style=shape.triangleup, location=location.belowbar, color=green, text="longentry", size=size.small)
plot(ema10, title="Ema 10", color = green, linewidth = 1, transp=1)
plot(ema20, title="Ema 20", color = red, linewidth = 1, transp=1)
study("Crossover and highcrossover", overlay=true)
ema10 = ema(close, 10)
ema20 = ema(close, 20)
psar = sar(0.02,0.02,0.2)
crossoverval = crossover(ema10,ema20)
signalhigh = iff(crossoverval == 1, high, na)
highbufferadd = signalhigh + 3.0
plot(signalhigh, title="signalhigh", color = color.green, linewidth = 1, transp=1)
plot(highbufferadd, title="highbufferadd", color = color.yellow, linewidth = 1, transp=1)
longentry = crossoverval and (close > highbufferadd)

plotshape(series=crossoverval, title="Crossover", style=shape.arrowup, location=location.belowbar, color=color.green, text="Crossover", size=size.small)
plotshape(series=longentry, title="longentry", style=shape.triangleup, location=location.belowbar, color=color.green, text="longentry", size=size.small)
plot(ema10, title="Ema 10", color = color.green, linewidth = 1, transp=1)
plot(ema20, title="Ema 20", color = color.red, linewidth = 1, transp=1)

最新更新