将Pine-Script版本2.0转换为版本5.0

发布于 2025-02-11 18:17:05 字数 1113 浏览 1 评论 0原文

我需要帮助将此指标从V2转换为V5。对我来说非常复杂。

//@version=2
study("Heiken Ashi MTF")
ha_t = heikinashi(tickerid)

res = input('60', title="TM 1")
ha_open = security(ha_t, res, open)
ha_close = security(ha_t, res, close)
ha_dif = ha_open-ha_close
ha_diff=iff(ha_dif > 0, 1, iff(ha_dif<0, 2, 3))

res2 = input('240', title="TM 2")
ha_open2 = security(ha_t, res2, open)
ha_close2 = security(ha_t, res2, close)
ha_dif2 = ha_open2-ha_close2
ha_diff2=iff(ha_dif2 > 0, 1, iff(ha_dif2<0, 2, 3))

res3 = input('D', title="TM 3")
ha_open3 = security(ha_t, res3, open)
ha_close3 = security(ha_t, res3, close)
ha_dif3 = ha_open3-ha_close3
ha_diff3=iff(ha_dif3 > 0, 1, iff(ha_dif3<0, 2, 3))

plot(15, title="TF1", color=iff(ha_diff==1, red, iff(ha_diff==2, green, white)), style=circles, linewidth=5, join=true)
plot(14, title="TF2", color=iff(ha_diff2==1, red, iff(ha_diff2==2, green, white)), style=circles, linewidth=5, join=true)
plot(13, title="TF3", color=iff(ha_diff3==1, red, iff(ha_diff3==2, green, white)), style=circles, linewidth=5, join=true)

代码为v2,我需要v5。但这是如此复杂。我需要V5中的一些功能。

i need help to convert this Indicator from V2 to V5. It is very complex for me.

//@version=2
study("Heiken Ashi MTF")
ha_t = heikinashi(tickerid)

res = input('60', title="TM 1")
ha_open = security(ha_t, res, open)
ha_close = security(ha_t, res, close)
ha_dif = ha_open-ha_close
ha_diff=iff(ha_dif > 0, 1, iff(ha_dif<0, 2, 3))

res2 = input('240', title="TM 2")
ha_open2 = security(ha_t, res2, open)
ha_close2 = security(ha_t, res2, close)
ha_dif2 = ha_open2-ha_close2
ha_diff2=iff(ha_dif2 > 0, 1, iff(ha_dif2<0, 2, 3))

res3 = input('D', title="TM 3")
ha_open3 = security(ha_t, res3, open)
ha_close3 = security(ha_t, res3, close)
ha_dif3 = ha_open3-ha_close3
ha_diff3=iff(ha_dif3 > 0, 1, iff(ha_dif3<0, 2, 3))

plot(15, title="TF1", color=iff(ha_diff==1, red, iff(ha_diff==2, green, white)), style=circles, linewidth=5, join=true)
plot(14, title="TF2", color=iff(ha_diff2==1, red, iff(ha_diff2==2, green, white)), style=circles, linewidth=5, join=true)
plot(13, title="TF3", color=iff(ha_diff3==1, red, iff(ha_diff3==2, green, white)), style=circles, linewidth=5, join=true)

the code is v2 and i need v5. but this is so complicated. i need some features in v5.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

如果没有 2025-02-18 18:17:05
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © seriousCockato20483

//@version=5
indicator("Heiken Ashi MTF")
ha_t = ticker.heikinashi(syminfo.tickerid)

res = input('60', title="TM 1")
ha_open = request.security(ha_t, res, open, barmerge.gaps_off, barmerge.lookahead_on)
ha_close = request.security(ha_t, res, close, barmerge.gaps_off, barmerge.lookahead_on)
ha_dif = ha_open-ha_close
ha_diff=ha_dif > 0?  1: (ha_dif<0? 2: 3)

res2 = input('240', title="TM 2")
ha_open2 =  request.security(ha_t, res2, open, barmerge.gaps_off, barmerge.lookahead_on)
ha_close2 =  request.security(ha_t, res2, close, barmerge.gaps_off, barmerge.lookahead_on)
ha_dif2 = ha_open2-ha_close2
ha_diff2=ha_dif2 > 0?  1: (ha_dif2<0? 2: 3)

res3 = input('D', title="TM 3")
ha_open3 =  request.security(ha_t, res3, open, barmerge.gaps_off, barmerge.lookahead_on)
ha_close3 = request.security(ha_t, res3, close, barmerge.gaps_off, barmerge.lookahead_on)
ha_dif3 = ha_open3-ha_close3
ha_diff3=ha_dif3 > 0?  1: (ha_dif3<0? 2: 3)

plot(15, title="TF1", color=ha_diff==1? color.red:(ha_diff==2? color.green: color.white), style=plot.style_circles, linewidth=5, join=true)
plot(14, title="TF2", color=ha_diff2==1? color.red:(ha_diff2==2? color.green: color.white), style=plot.style_circles, linewidth=5, join=true)
plot(13, title="TF3", color=ha_diff3==1? color.red:(ha_diff3==2? color.green: color.white), style=plot.style_circles, linewidth=5, join=true)
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © seriousCockato20483

//@version=5
indicator("Heiken Ashi MTF")
ha_t = ticker.heikinashi(syminfo.tickerid)

res = input('60', title="TM 1")
ha_open = request.security(ha_t, res, open, barmerge.gaps_off, barmerge.lookahead_on)
ha_close = request.security(ha_t, res, close, barmerge.gaps_off, barmerge.lookahead_on)
ha_dif = ha_open-ha_close
ha_diff=ha_dif > 0?  1: (ha_dif<0? 2: 3)

res2 = input('240', title="TM 2")
ha_open2 =  request.security(ha_t, res2, open, barmerge.gaps_off, barmerge.lookahead_on)
ha_close2 =  request.security(ha_t, res2, close, barmerge.gaps_off, barmerge.lookahead_on)
ha_dif2 = ha_open2-ha_close2
ha_diff2=ha_dif2 > 0?  1: (ha_dif2<0? 2: 3)

res3 = input('D', title="TM 3")
ha_open3 =  request.security(ha_t, res3, open, barmerge.gaps_off, barmerge.lookahead_on)
ha_close3 = request.security(ha_t, res3, close, barmerge.gaps_off, barmerge.lookahead_on)
ha_dif3 = ha_open3-ha_close3
ha_diff3=ha_dif3 > 0?  1: (ha_dif3<0? 2: 3)

plot(15, title="TF1", color=ha_diff==1? color.red:(ha_diff==2? color.green: color.white), style=plot.style_circles, linewidth=5, join=true)
plot(14, title="TF2", color=ha_diff2==1? color.red:(ha_diff2==2? color.green: color.white), style=plot.style_circles, linewidth=5, join=true)
plot(13, title="TF3", color=ha_diff3==1? color.red:(ha_diff3==2? color.green: color.white), style=plot.style_circles, linewidth=5, join=true)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文