JSS Table - RSI, DI+, DI-, ADX
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © jatinder.sodhi
//Table to have ADX, RSI, DI values
//@version=5
indicator(title="JSSTable", shorttitle="JSSTable", overlay=true)
//rsi
mrsi = ta.rsi(close,14)
colorRsi = mrsi>55?color.green: mrsi<45?color.red:color.gray

//ADX
len = input.int(14, minval=1, title="DI Length")
lensig = input.int(14, title="ADX Smoothing", minval=1, maxval=50)
[diplus, diminus, adx] = ta.dmi(len, lensig)
colorADX = adx>25?color.rgb(33, 208, 243):color.gray

//creating the table
var testTable = table.new(position = position.top_right, columns = 4, rows = 2, border_width = 1, border_color = color.black, frame_width = 1, frame_color = color.black)

//column Headings
table.cell(table_id = testTable, column = 0, row = 0, text = " RSI ", bgcolor=color.aqua, text_color = color.white)
table.cell(table_id = testTable, column = 1, row = 0, text = " DI+ ", bgcolor=color.green, text_color = color.white)
table.cell(table_id = testTable, column = 2, row = 0, text = " DI- ", bgcolor=color.red, text_color = color.white)
table.cell(table_id = testTable, column = 3, row = 0, text = " ADX ", bgcolor=color.aqua, text_color = color.white)

//column values
table.cell(table_id = testTable, column = 0, row = 1, text = str.tostring(math.round(mrsi,0)) ,  bgcolor= color.aqua, text_color = color.white)
table.cell(table_id = testTable, column = 1, row = 1, text = str.tostring(math.round(diplus,0)) ,  bgcolor= color.green, text_color = color.white)// "RSI")//, bgcolor=color.red)
table.cell(table_id = testTable, column = 2, row = 1, text = str.tostring(math.round(diminus,0)) ,  bgcolor= color.red, text_color = color.white)// "DI+")//, bgcolor=color.red)
table.cell(table_id = testTable, column = 3, row = 1, text = str.tostring(math.round(adx,0)) ,  bgcolor= color.aqua, text_color = color.white)//"DI-")//, bgcolor=color.red)