Pinescript鲨鱼鳍的上升和下降功能

发布于 2025-01-25 16:40:47 字数 941 浏览 2 评论 0原文

我想在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

罪歌 2025-02-01 16:40:47

在这种情况下,使用Crossover()crossunder()函数可能会更好:

//@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.crossover(mf, 90)
isFallingSell2 = ta.crossunder(mf, 90)

isFallingBuy1 = ta.crossunder(mf, 10)
isRisingBuy2 = ta.crossover(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)

In this case, it might be better with the crossover() and crossunder() functions:

//@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.crossover(mf, 90)
isFallingSell2 = ta.crossunder(mf, 90)

isFallingBuy1 = ta.crossunder(mf, 10)
isRisingBuy2 = ta.crossover(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)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文