我需要帮助把这个指示器从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的特性。
发布于 2022-06-30 09:14:16
// 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)https://stackoverflow.com/questions/72812497
复制相似问题