ta.valuewhen 中使用的 ta.pivotlow 和 ta.pivotlow 的区别

发布于 2025-01-10 05:38:33 字数 470 浏览 0 评论 0原文

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

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

发布评论

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

评论(1

话少心凉 2025-01-17 05:38:33

这是因为在您的 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文