1

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

user3848207
  • 3,737
  • 17
  • 59
  • 104

2 Answers2

1

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.

vitruvius
  • 15,740
  • 3
  • 16
  • 26
0

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)
user3848207
  • 3,737
  • 17
  • 59
  • 104