Reputation: 19
am trying to get all numbers from 0 to a variable "history bars + len" in pinesccript, i used the code below but i got an error that it does not returns series int, i need help with rewriting the code
// generate values from 0 to historybars+len
A() =>
customArray = array.new_int()
for i = 0 to historyBars +len
array.push(customArray, i)
customArray
var ArrayClose = matrix.new<float>(A(),NumCol,historyBars + len)
var ArrayLo = matrix.new<float>(A(),NumCol,historyBars + len)
var ArrayHi = matrix.new<float>(A(),NumCol,historyBars + len)
Cannot call 'matrix.new' with argument 'columns'='call 'A' (float[])'. An argument of 'float[]' type was used but a 'series int' is expected.
Upvotes: 0
Views: 69
Reputation: 1961
https://www.tradingview.com/pine-script-docs/en/v5/language/Matrices.html
if barstate.islastconfirmedhistory
var ArrayClose = matrix.new<int>()
ArrayClose.add_col(0, A())
label.new(bar_index,high, str.tostring(ArrayClose))
Upvotes: 0