我用3 MA(18ema,50ema和200sma)编写了此策略... 在我的15分钟图表(我用于交易)上,如果18ema低于50ema,50ema低于200sma,并且18ema必须低于50ema,50ema必低于200sma,则我在图表上方绘制红色菱形,如下所示: Signal
这将是寻找简短的条目。相反的事情会持续很长时间……到目前为止一切都很好。我想要做的是,而不是通过图表来查找这些设置,而是可以执行以下操作: standalone indicator
如果18ema低于50ema而50ema低于200sma,则在M15框中显示红色菱形,如上图所示 如果18ema低于50ema,而50ema低于200sma,则在1HR框中显示红色菱形,就像上图所示的货币对AUDUSD ...对x货币量重复相同的操作...再次如上图所示。底线是有一个地方可以查找设置,而不是翻阅图表。
这是我目前正在使用的代码,如上面的第一张图片所示:
//@version=3
study(title="Inpulse Pullback 15", overlay=true)
s18ema = ema(close, 18) //slower 18EMA
s50ema = ema(close, 50) //medium 50EMA
s200sma = sma(close, 200) //slowest 200SMA
price = open[1]
s2 = security(tickerid, "60", s18ema) // 60 Minutes
s3 = security(tickerid, "60", s50ema) // 60 Minutes
s4 = security(tickerid, "60", s200sma) // 60 Minutes
plot(s18ema, title="EMA 18", color = aqua, linewidth = 1, transp=0)
plot(s50ema, title="EMA 50", color = orange, linewidth = 2, transp=0)
plot(s200sma, title="SMA 200", color = blue, linewidth = 2, transp=0)
longCondSig = (s18ema > s50ema) and (s50ema > s200sma) and (s2 > s3) and (s3 > s4)
shortCondSig = (s18ema < s50ema) and (s50ema < s200sma) and (s2 < s3) and (s3 < s4)
plotshape(series=longCondSig, title="Long", style=shape.diamond, location=location.top, color=#29ee0b, transp=0, size=size.small)
plotshape(series=shortCondSig, title="Short", style=shape.diamond, location=location.top, color=red, transp=0, size=size.small)
longEntry = longCondSig ==1
shortEntry = shortCondSig ==1
alertcondition(longEntry, "le", "le")
alertcondition(shortEntry, "se", "se")