【发布时间】:2022-12-02 10:25:33
【问题描述】:
I have the following code in Pinescript where I am basically trying to slice a timeseries into an array to be used within NextFunction.
When using an array instantiated directly with array.from, NextFunction works correctly. But when instantiated by LoadArray, it does not work. Why would be it so? How to turn LoadArray into a function compatible with NextFunction?
Ps.:NextFunction uses matrices to perform its computations.
LoadArray(series, length) =>
res = array.new_float(length)
for i = length - 1 to 0
array.set(res, i, series[i])
res := res
NextFunction(y) =>
...
...
y = LoadArray(close, 5)
y2 = array.from(1212.3, 1211.6, 1212.7, 1214.8, 1216.1)
res1 = NextFunction(y2) // works alright
res2 = NextFunction(y) // does not work
I expected that the resulting arrays y and y2 would be equal and behave in the very same way within NextFunction. But they, for any reason, do not.
I tried to use History Referencing without success.
【问题讨论】:
标签: pine-script