脚本触发警报不正确

时间:2021-06-14 07:40:20

标签: pine-script

我有下面的脚本,因为我想在 MA 跨越 30 分钟图上的每个柱线时发出警报

//@version=4
study("Moving Averages Test", overlay=true)

ema_slow = ema(close,7)
ema_fast = ema(close,80)

emaSlowSecurity = security(syminfo.tickerid,'60',ema_slow)
emaFastSecurity = security(syminfo.tickerid,'60',ema_fast)

buy = crossover(emaSlowSecurity, emaFastSecurity)
sell = crossover(emaFastSecurity, emaSlowSecurity)

plot(emaSlowSecurity, color=color.blue, linewidth=2)
plot(emaFastSecurity, color=color.yellow, linewidth=2)

plotshape(buy, style=shape.triangleup, size=size.normal, title='SMA25', color=color.green,text='Buy',location=location.belowbar, transp=0)
plotshape(sell, style=shape.triangledown, size=size.normal, title='SMA25', color=color.red,text='Sell',location=location.abovebar, transp=0)

alertcondition(
  buy,
  title      = "MA Cross",
  message    = "MA Cross")

但奇怪的是,虽然在图表上显示了正确的警报,但它发出了如此多的警报,这是我的警报的图像

enter image description here

请指教

0 个答案:

没有答案