safetyduck
safetyduck

Reputation: 6834

How can we draw a scatter chart in TradingView Pine script language?

I see lots of examples of plotting one symbol across time but nothing yet to do with plotting x vs y.

Upvotes: 0

Views: 710

Answers (1)

PineCoders-LucF
PineCoders-LucF

Reputation: 8779

Pine uses time series as its core data type, TV's charting engine is optimized for the display of time series and the input data Pine scripts use for calculations is usually time series, so time is usually going to be your x axis. The y axis can be price, but anything else as well.

Note that you could always decide that bar_index means something other for you than one unit of time, but then data has to be fed manually into series using literals, as there is no way to import series from the external world into Pine scripts, unless it's available from the TV-supplied feeds, and you will be forced to display your data using a time-based rendering engine and UI.

You can draw scatter charts, but the x axis will be time, as RicardoSantos does here:

enter image description here

Upvotes: 1

Related Questions