TradingView
machdragon
14 kwi 2022 23:28

SymMatrixTable 

Bitcoin / TetherUSBinance

Opis

Simple Example Table for Displaying Price, RSI, Volume of multiple Tickers on selected Timeframe

Displays Price, RSI and Volume of 3 Tickers and Timeframe selected by user input

Conditional Table Cell coloring
Price color green if > than previous candle close and red if < previous candle close
RSI color green if < 30 and red if > 70 (RSI14 by default)
Volume color green if above average volume and red if less than that (SMA20 volume by default)

Can turn on/off whole table, header columns, row indices, or select individual columns or rows to show/hide

// Example Mixed Type Matrix To Table //
access the simple example script by uncommenting the code at the end

Basically I wanted to have the headers and indices as strings and the rest of the matrix for the table body as floats, then conditional coloring on the table cells
And also the functionality to turn rows and columns on/off from table through checkboxes of user input

Before I was storing each of the values separately in arrays that didn't have a centralized way of controlling table structure

so now the structure is :
- string header array, string index array
- float matrix for table body
- color matrix with bool conditions for coloring table cells
- bool checkboxes for controlling table display

Informacje o Wersji

Updated example code description comments for better readability/simplicity
No changes to script functionality
Komentarze
yash1809
it's useful but i want to do 10x3 matrix how can i add more symbol than 3... need your help
maxiburger
Useful script !!

Line 66 it should be index not header, ==> result_mat = matrix.new<float>(array.size(index_arr),0)
machdragon
@maxiburger, Hi thanks for the comment, yes nice catch! It should be initializing the matrix with array.size equal the the number of rows in index_arr. This is just a basic sample implementation to describe the functionality I've used in a more complex private script, for the public to use this open source code to build their own tables to compare data across different tickers using a table. Although, I later found using arrays rather than matrices was more flexible and robust in creating custom tables. As matrices must contain all of the same type, so you would need to run another function to cast types when creating the matrix table, whereas with arrays you can just concatenate different arrays together which was simpler to do imo.
Więcej