我正在尝试自动化简单的策略,以便在满足条件时获得警报。
我想检查是否有办法检查 5 分钟蜡烛是否穿过 8、13、55 EMA。有什么办法可以做到吗?
我的要求:
我想检查 5 分钟图表中的绿色或红色蜡烛是否位于给定时间点的所有 3 个 SMA(8,13,55)上。现在我用 AND 运算符给出 2 个不同的值,但它不起作用。
我需要找出 EMA 交叉 VWAP 和 EMA 触及 VWAP 之间的区别。
我需要计算前 15 分钟的 ORB 高低范围。
//@version=5
indicator("EMA5 & VWAP Crossover ActualAlert Working", overlay= true)
// Calculate values
emaValue8 = ta.ema(close,8)
emaValue21 = ta.ema(close,21)
vwapValue = ta.vwap(hlc3)
smaValue200 = ta.sma(close,200)
emaValue50 = ta.ema(close,50)
//plotting on map
plot(smaValue200, title="SMA200",color=color.rgb(238, 247, 122), linewidth=1,style= plot.style_circles)
plot(emaValue8, title="EMA8",color=color.rgb(71, 197, 178), linewidth=1)
plot(vwapValue, title="VWAP", color=color.white, linewidth=2)
plot(emaValue21, title="EMA21", color=color.rgb(204, 71, 142), linewidth=1)
plot(emaValue50, title="EMA50", color=color.rgb(241, 218, 84), linewidth=1)
plotshape(series = (ta.crossover(emaValue8,vwapValue) or (ta.crossover(vwapValue,emaValue21))) , title = "BUY",style=shape.flag, location=location.belowbar, color=#9FE2BF, size=size.small)
plotshape(series = (ta.crossunder(emaValue8,vwapValue) or ta.crossunder(emaValue21,vwapValue)) , title = "SELL" ,style=shape.flag, location=location.abovebar, color=#f18f0d, size=size.small)
要检查交叉,您可以使用:
ta.crossover(source1, source2)
请参阅此处:PineScript 手册
当蜡烛超过 3 Emas 时触发,请执行以下操作:
triggeralert = false
if close > emaValue8 and close > emaValuer and close > emaValue50
triggeralert := true
然后定义您的警报。