Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
假设我们有一系列数字。它包含一些值[..., 3, 6, 4, 7]。我想获得最多 100 个最后的元素。
[..., 3, 6, 4, 7]
我试过max(series[100])了,但看起来 series[100] 运算符返回丢弃最后 100 个元素的子系列。
max(series[100])
这是正确的。在 Pine-script中,所有的东西都变成了一个系列,一旦你使用它就变成了一个常数,因为所有的函数都返回一个series. 这意味着,您始终可以将(非系列)常量放入 中,但永远无法将它们取出。
series
我想你想要的是:
//@version=3 study("Max of N", shorttitle="max", overlay=false) nmax = highest(n, 100) // n is the series of ALL bars plot(nmax, style=line)