如何计算2个蜡烛之间分别符合松树脚本不同条件的棒数
给定2个真正的虚假条件A和B 我想搜索这两个条件之间所有蜡烛的低点。 脚本加载,但错误说“'length”参数的无效值(0.0)在“最低”函数中。必须是> 0”
有人可以帮忙吗?谢谢
var int nb_bars = 0
nb_bars := B? ta.barssince(A)[2] : 0 // I have [2] because condition A could trigger just before condition B, I want to search the A which is further away
ClusterLow = B ? ta.lowest(nb_bars) : na
Given 2 true false conditions A and B
I would like to search for the low of all the candles between these 2 conditions.
the script load, but an error say "invalid value of the 'length' argument (0.0) in the "lowest" function. it must be >0"
Could someone help please? Thanks
var int nb_bars = 0
nb_bars := B? ta.barssince(A)[2] : 0 // I have [2] because condition A could trigger just before condition B, I want to search the A which is further away
ClusterLow = B ? ta.lowest(nb_bars) : na
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
错误是明确的,您无法将
length
设置为零。ta.barssince(a)[2]
如果条件A从现在开始2 bars发生,则发生在2个Bars 2 bars之前,它发生了。如果用[2]
偏向索引,则必须偏长参数。尝试
clusterlow = b? ta.Lowest(NB_BARS + 2):NA
The error is clear, you cannot set the
length
to zero.And
ta.barssince(A)[2]
can also be zero if condition A happened 2 bars ago from now, then it happened 0 bars back 2 bars ago. If you skew the index with[2]
, you have to skew the length parameter as well.Try
ClusterLow = B ? ta.lowest(nb_bars + 2) : na