Reputation: 4967
I have a pinescript array declared like this;
var array_contents = array.new_float(2)
Assume that the contents of this array have been assigned.
How can I view the contents of each element in the array in pinescript? I am open to any method (printchar(), plot(), table.new()
etc)
I am using pine-script v5
Upvotes: 1
Views: 767
Reputation: 4967
This pinescript library comes in handy. It is simple to use and solves the problem.
https://in.tradingview.com/script/Bcm0mGop-pta-plot/
import protradingart/pta_plot/7 as pp
pp.print_array_float(array_contents)
Upvotes: 1
Reputation: 21294
In order to print dynamic values you should use a table
. Get the array size with array.size()
and figure out how many columns you need. Then create your table with table.new()
.
After that loop over the contents of your array and use table.cell()
to fill your cells.
Upvotes: 1