在pinescriptv4
中,可以传递一个序列作为length
参数。
如文档所述:
If x is a series and y is a series then x and y are considered to be 2 calculated MAs for upward and downward changes.
现在用v5
是不可能的了。你只能传递一个简单的整数。
考虑到不可能将一个序列转换为一个简单的整数,我如何实现前面的行为?
如果您想实现在v4中将序列长度传递给rsi()
时发生的相同行为,则可以使用公式。公式见Pine用户手册:
100.0 - (100.0 / (1.0 + arg1 / arg2))