我正在尝试使用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)发布于 2020-10-27 19:26:28
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)https://stackoverflow.com/questions/64186745
复制相似问题