Pinescript鲨鱼鳍的上升和下降功能
我想在MFI上升到90和10或10或90以上时使用MFI创建一个鲨鱼鳍指示器。但是,我似乎无法正确绘制它。
//@version=5
indicator(title="Money Flow Index", shorttitle="MFI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
length = input.int(title="Length", defval=7, minval=1, maxval=2000)
src = hlc3
mf = ta.mfi(src, length)
plot(mf, "MF", color=#7E57C2)
overbought=hline(80, title="Overbought", color=#787B86)
oversold=hline(20, title="Oversold", color=#787B86)
fill(overbought, oversold, color=color.rgb(126, 87, 194, 90), title="Background")
isRisingSell1 = ta.rising(mf, 90)
isFallingSell2 = ta.falling(mf, 90)
isFallingBuy1 = ta.falling(mf, 10)
isRisingBuy2 = ta.rising(mf, 10)
plotshape(isRisingSell1, color=color.orange, style=shape.circle)
plotshape(isFallingSell2, color=color.red, style=shape.circle)
plotshape(isFallingBuy1, color=color.lime, style=shape.circle)
plotshape(isRisingBuy2, color=color.green, style=shape.circle)
I would like to create a sharks fin indicator using MFI whenever it rise above 90 and 10 or falls below 10 or 90. However I can't seem to plot it correctly.
//@version=5
indicator(title="Money Flow Index", shorttitle="MFI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
length = input.int(title="Length", defval=7, minval=1, maxval=2000)
src = hlc3
mf = ta.mfi(src, length)
plot(mf, "MF", color=#7E57C2)
overbought=hline(80, title="Overbought", color=#787B86)
oversold=hline(20, title="Oversold", color=#787B86)
fill(overbought, oversold, color=color.rgb(126, 87, 194, 90), title="Background")
isRisingSell1 = ta.rising(mf, 90)
isFallingSell2 = ta.falling(mf, 90)
isFallingBuy1 = ta.falling(mf, 10)
isRisingBuy2 = ta.rising(mf, 10)
plotshape(isRisingSell1, color=color.orange, style=shape.circle)
plotshape(isFallingSell2, color=color.red, style=shape.circle)
plotshape(isFallingBuy1, color=color.lime, style=shape.circle)
plotshape(isRisingBuy2, color=color.green, style=shape.circle)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,使用
Crossover()
和crossunder()
函数可能会更好:In this case, it might be better with the
crossover()
andcrossunder()
functions: