ta.valuewhen 中使用的 ta.pivotlow 和 ta.pivotlow 的区别
我是 pinescript 的新手,一直在研究pivotlow/pivothigh。让我困惑的部分是下面两个主元计算之间的差异:
leftbars = 2
rightbars = 2
pivotLow = ta.pivotlow(low, leftbars, rightbars) // Returns the pivotlow value or NaN if not applicable
recentPivotLow = ta.valuewhen(ta.pivotlow(low, leftbars, rightbars), low, 0) // Returns the most recent pivot low value
当检查pivotLow和recentPivotLow的值时,存在差异,而我期望它们是相同的,因为ta.valuewhen返回'0'时的最近一次出现被传承下来。想了解为什么会有差异以及差异从何而来。
I'm new to pinescript and have been looking at pivotlow/pivothigh. The part that confuses me is the difference between the two pivot calculations below:
leftbars = 2
rightbars = 2
pivotLow = ta.pivotlow(low, leftbars, rightbars) // Returns the pivotlow value or NaN if not applicable
recentPivotLow = ta.valuewhen(ta.pivotlow(low, leftbars, rightbars), low, 0) // Returns the most recent pivot low value
When checking the value of pivotLow and recentPivotLow, there's a difference while I would be expecting them to be the same since ta.valuewhen returns the most recent occurrence when '0' is passed along. Would like to understand why there's a difference and where its coming from.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是因为在您的 valuewhen 变化中,您要求找到枢轴时的最低值,这与 low[right] 不同。
尝试 low[right] 或在 valuewhen 中使用相同的枢轴条件。或者根本不使用它,因为不需要它。
干杯并祝你好运
It's because within your valuewhen variation you are asking for the low when the pivot was found, which is not the same as the low[right]
Try low[right] or use the same pivot condition within the value when. Or don't use it at all because it's not needed.
Cheers and best of luck