如何找到条件的酒吧

发布于 2025-01-21 14:10:48 字数 528 浏览 1 评论 0原文

我想找到符合与当前栏有关的某些条件的栏(栏索引)。 例如,在所有最低价格大于当前最低价格(插图上的黄色矩形)的所有条中,我想获得与当前栏(蓝色箭头)的最低(或最高)价格差的栏。

我尝试使用ta.barssince()和类似的功能。但是在我看来,需要某种“系列系列”类型来完成我想要的事情。

是否可以使用Pine脚本进行此类操作?还是使用循环是唯一的方法?

I want to find bar (bar index) which meets some condition related to the current bar.
For example, among all bars which minimum prices are greater than current minimum price (yellow rectangle on the illustrations) I want to get bar with minimum (or maximum) price difference with current bar (blue arrows).

I tried to use ta.barssince() and similar funtions. But it seems to me that some sort of "series of series" types is needed to do what I want.

Is it possible to do such things with pine script? Or is using loops the only way?

Illustration 1
Illustration 2

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

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

发布评论

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

评论(1

ㄟ。诗瑗 2025-01-28 14:10:48

我在 pine脚本文档

循环存在是有充分理由的,因为即使在松树中,它们也是必要的
在某些情况下。这些情况通常包括:

  • 阵列的操纵。
  • 回顾历史记录以使用参考值分析条
    只能在当前的栏上知道,例如找到过去多少
    高点高于当前条的高。自电流以来
    酒吧的高位仅在脚本运行的栏上知道,一个循环
    需要回到过去并分析过去的酒吧。
  • 对过去无法使用的过去条进行计算
    Pine的内置功能,例如Pearson相关系数。

第二种情况只是我的。

I've found the answer to my question in the pine script documentation:

Loops exist for good reason because even in Pine, they are necessary
in some cases. These cases typically include:

  • The manipulation of arrays.
  • Looking back in history to analyze bars using a reference value that
    can only be known on the current bar, e.g., to find how many past
    highs are higher than the high of the current bar. Since the current
    bar’s high is only known on the bar the script is running on, a loop
    is necessary to go back in time and analyze past bars.
  • Performing calculations on past bars that cannot be accomplished using
    Pine’s built-in functions, like the Pearson correlation coefficient.

The second case is just mine.

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