Everything about the tables and the cells is completely controllable by the user! Here is a breakdown of how customizable the user can make this indicator:
Use text size “Auto” if viewing the same chart on desktop and on smartphone (Auto makes the text scale based upon screen size)
// © Infinity_Trading_
// Last Modified: 6/20/2022
//@version=5
indicator ( title = " Streamer Watermark " , shorttitle = " _Watermark " , overlay = true )
// Purpose: Displays two tables. The first table displays day of the week, date, and a free form text box where the user can insert any text.
// The second table displays the ticker symbol and the current chart timeframe.
// Usage: Everything on this indicator can be adjusted! Tables can be turned on and off, moved to 9 different locations around the screen, background color, border color,
// border width, and frame width for each individual table.
// Each of the cells can be individually toggled on and off for complete control of look of the users chart. The text in the cells can be individually controlled
// by text color and text size. And the date text can be formatted to 12 unique date formats.
// https://www.tradingview.com/pine-script-docs/en/v5/concepts/Time.html
///////////////////////////////////////////////////////////////////////////////// INPUTS
var string GP2 = " Date Table "
i_tbl_toggle = input . bool ( defval = true , title = " Date Table " , group = GP2 )
i_tbl_bg_color = input . color ( defval = color . rgb ( 149 , 152 , 161 , 100 ), title = " Background " , group = GP2 , inline = " table_color " ) // rgb(149,152,161)
i_tbl_border_color = input . color ( defval = color . rgb ( 30 , 39 , 46 , 100 ), title = " Border " , group = GP2 , inline = " table_color " ) // Black Pearl
// Convert boolean to int
i_tbl_weekday_toggle = input . bool ( defval = true , title = " Wkday Cell " , group = GP2 , inline = " weekday " ) ? 1 : 0
i_tbl_weekday_text_color = input . color ( defval = color . rgb ( 241 , 242 , 246 , 0 ), title = "" , group = GP2 , inline = " weekday " ) // Anti-Flash White
i_tbl_weekday_text_size = input . string ( defval = " Normal " , title = " Size " , options = [ " Tiny " , " Small " , " Normal " , " Large " , " Huge " , " Auto " ], group = GP2 , inline = " weekday " )
// Convert boolean to int
i_tbl_date_toggle = input . bool ( defval = true , title = " Date Cell " , group = GP2 , inline = " date " ) ? 1 : 0
i_tbl_date_text_color = input . color ( defval = color . rgb ( 241 , 242 , 246 , 0 ), title = "" , group = GP2 , inline = " date " )
i_tbl_date_text_size = input . string ( defval = " Normal " , title = " Size " , options = [ " Tiny " , " Small " , " Normal " , " Large " , " Huge " , " Auto " ], group = GP2 , inline = " date " )
i_tbl_date_format = input . string ( defval = " MM/dd/yyyy " , title = " Date Format " , options = [ " MM/dd/yyyy " , " MM.dd.yyyy " , " MM-dd-yyyy " , " dd/MM/yyyy " , " dd.MM.yyyy " , " dd-MM-yyyy " , " M/d/yyyy " , " M.d.yyyy " , " M-d-yyyy " , " d/M/yyyy " , " d.M.yyyy " , " d-M-yyyy " ], group = GP2 )
// Convert boolean to int
i_tbl_input_toggle = input . bool ( defval = true , title = " Input Cell " , group = GP2 , inline = " input " ) ? 1 : 0
i_tbl_input_text_color = input . color ( defval = color . rgb ( 241 , 242 , 246 , 0 ), title = "" , group = GP2 , inline = " input " )
i_tbl_input_text_size = input . string ( defval = " Normal " , title = " Size " , options = [ " Tiny " , " Small " , " Normal " , " Large " , " Huge " , " Auto " ], group = GP2 , inline = " input " )
i_tbl_input_text = input . string ( defval = " your text here " , title = " Input Text " , group = GP2 )
i_tbl_frame_width = input . int ( defval = 2 , title = " Frame Width " , minval = 1 , maxval = 20 , group = GP2 )
i_tbl_border_width = input . int ( defval = 1 , title = " Border Width " , minval = 1 , maxval = 20 , group = GP2 )
string i_tableYpos = input . string ( defval = " bottom " , title = " Position " , inline = " 11 " , options = [ " top " , " middle " , " bottom " ], group = GP2 )
string i_tableXpos = input . string ( defval = " left " , title = "" , inline = " 11 " , options = [ " left " , " center " , " right " ], group = GP2 )
var string GPT = " Ticker Table "
i_tkr_tbl_toggle = input . bool ( defval = true , title = " Ticker Table " , group = GPT )
i_tkr_tbl_bg_color = input . color ( defval = color . rgb ( 149 , 152 , 161 , 100 ), title = " Background " , group = GPT , inline = " ticker_color " ) // rgb(149,152,161)
i_tkr_tbl_border_color = input . color ( defval = color . rgb ( 30 , 39 , 46 , 100 ), title = " Border " , group = GPT , inline = " ticker_color " ) // Black Pearl
// Convert boolean to int
i_tkr_tbl_symbol_toggle = input . bool ( defval = true , title = " Ticker Cell " , group = GPT , inline = " symbol " ) ? 1 : 0
i_tkr_tbl_symbol_text_color = input . color ( defval = color . rgb ( 241 , 242 , 246 , 0 ), title = "" , group = GPT , inline = " symbol " ) // Anti-Flash White
i_tkr_tbl_symbol_text_size = input . string ( defval = " Normal " , title = " Size " , options = [ " Tiny " , " Small " , " Normal " , " Large " , " Huge " , " Auto " ], group = GPT , inline = " symbol " )
// Convert boolean to int
i_tkr_tbl_timeframe_toggle = input . bool ( defval = true , title = " Timeframe Cell " , group = GPT , inline = " timeframe " ) ? 1 : 0
i_tkr_tbl_timeframe_text_color = input . color ( defval = color . rgb ( 241 , 242 , 246 , 0 ), title = "" , group = GPT , inline = " timeframe " ) // Anti-Flash White
i_tkr_tbl_timeframe_text_size = input . string ( defval = " Normal " , title = " Size " , options = [ " Tiny " , " Small " , " Normal " , " Large " , " Huge " , " Auto " ], group = GPT , inline = " timeframe " )
i_tkr_tbl_frame_width = input . int ( defval = 2 , title = " Frame Width " , minval = 1 , maxval = 20 , group = GPT )
i_tkr_tbl_border_width = input . int ( defval = 1 , title = " Border Width " , minval = 1 , maxval = 20 , group = GPT )
string i_tkr_tableYpos = input . string ( defval = " bottom " , title = " Position " , inline = " 11 " , options = [ " top " , " middle " , " bottom " ], group = GPT )
string i_tkr_tableXpos = input . string ( defval = " right " , title = "" , inline = " 11 " , options = [ " left " , " center " , " right " ], group = GPT )
///////////////////////////////////////////////////////////////////////////////// HELPER FUNCTIONS
// Function that converts string inputs to text size code
dayofweek_text_function ( t ) =>
switch dayofweek ( t , " America/New_York " )
1 => " Sunday "
2 => " Monday "
3 => " Tuesday "
4 => " Wednesday "
5 => " Thursday "
6 => " Friday "
7 => " Saturday "
// Function that converts string inputs to text size code
text_size_function ( string_size ) =>
switch string_size
" Tiny " => size . tiny
" Small " => size . small
" Normal " => size . normal
" Large " => size . large
" Huge " => size . huge
" Auto " => size . auto
// Function that converts string timeframe.period to include minute or hour abbreviation
timeframe_text_function ( int_period ) =>
switch int_period
" 1 " => " 1m "
" 2 " => " 2m "
" 3 " => " 3m "
" 4 " => " 4m "
" 5 " => " 5m "
" 10 " => " 10m "
" 15 " => " 15m "
" 30 " => " 30m "
" 60 " => " 1h "
" 120 " => " 2h "
" 240 " => " 4h "
" 480 " => " 8h "
" 720 " => " 12h "
=> int_period
///////////////////////////////////////////////////////////////////////////////// TABLE
// Convert text size strings to code
tbl_weekday_text_size = text_size_function ( i_tbl_weekday_text_size )
tbl_date_text_size = text_size_function ( i_tbl_date_text_size )
tbl_input_text_size = text_size_function ( i_tbl_input_text_size )
tkr_tbl_symbol_text_size = text_size_function ( i_tkr_tbl_symbol_text_size )
tkr_tbl_timeframe_text_size = text_size_function ( i_tkr_tbl_timeframe_text_size )
// Number of cells in tables
date_cells = i_tbl_weekday_toggle + i_tbl_date_toggle + i_tbl_input_toggle
ticker_cells = i_tkr_tbl_symbol_toggle + i_tkr_tbl_timeframe_toggle
// Display table only on last bar to reduce computation time
if barstate . islast
// Date table creation and cell insertion
if i_tbl_toggle
// Create dynamically sized table based upon number of inputs checked
var table dateTable = table . new ( position = i_tableYpos + " _ " + i_tableXpos , columns = 1 , rows = date_cells , bgcolor = i_tbl_bg_color , frame_width = i_tbl_frame_width , frame_color = i_tbl_border_color , border_width = i_tbl_border_width , border_color = i_tbl_border_color )
if date_cells == 3
// Populate cells in table
// Weekday Cell
table . cell ( dateTable , 0 , 0 , text = str . tostring ( dayofweek_text_function ( time )), text_color = i_tbl_weekday_text_color , text_size = tbl_weekday_text_size )
// Date Cell
table . cell ( dateTable , 0 , 1 , text = str . format ( " {0,date, " + i_tbl_date_format + " } " , time ), text_color = i_tbl_date_text_color , text_size = tbl_date_text_size )
// Input Cell
table . cell ( dateTable , 0 , 2 , text = str . tostring ( i_tbl_input_text ), text_color = i_tbl_input_text_color , text_size = tbl_input_text_size )
if date_cells == 2
if i_tbl_weekday_toggle == 1 and i_tbl_date_toggle == 1
// Weekday Cell
table . cell ( dateTable , 0 , 0 , text = str . tostring ( dayofweek_text_function ( time )), text_color = i_tbl_weekday_text_color , text_size = tbl_weekday_text_size )
// Date Cell
table . cell ( dateTable , 0 , 1 , text = str . format ( " {0,date, " + i_tbl_date_format + " } " , time ), text_color = i_tbl_date_text_color , text_size = tbl_date_text_size )
if i_tbl_date_toggle == 1 and i_tbl_input_toggle == 1
// Date Cell
table . cell ( dateTable , 0 , 0 , text = str . format ( " {0,date, " + i_tbl_date_format + " } " , time ), text_color = i_tbl_date_text_color , text_size = tbl_date_text_size )
// Input Cell
table . cell ( dateTable , 0 , 1 , text = str . tostring ( i_tbl_input_text ), text_color = i_tbl_input_text_color , text_size = tbl_input_text_size )
if i_tbl_weekday_toggle == 1 and i_tbl_input_toggle == 1
// Weekday Cell
table . cell ( dateTable , 0 , 0 , text = str . tostring ( dayofweek_text_function ( time )), text_color = i_tbl_weekday_text_color , text_size = tbl_weekday_text_size )
// Input Cell
table . cell ( dateTable , 0 , 1 , text = str . tostring ( i_tbl_input_text ), text_color = i_tbl_input_text_color , text_size = tbl_input_text_size )
if date_cells == 1
if i_tbl_weekday_toggle == 1
// Weekday Cell
table . cell ( dateTable , 0 , 0 , text = str . tostring ( dayofweek_text_function ( time )), text_color = i_tbl_weekday_text_color , text_size = tbl_weekday_text_size )
if i_tbl_date_toggle == 1
// Date Cell
table . cell ( dateTable , 0 , 0 , text = str . format ( " {0,date, " + i_tbl_date_format + " } " , time ), text_color = i_tbl_date_text_color , text_size = tbl_date_text_size )
if i_tbl_input_toggle == 1
// Input Cell
table . cell ( dateTable , 0 , 0 , text = str . tostring ( i_tbl_input_text ), text_color = i_tbl_input_text_color , text_size = tbl_input_text_size )
// Ticker table creation and cell insertion
if i_tkr_tbl_toggle
// Create dynamically sized table based upon number of inputs checked
var table tickerTable = table . new ( position = i_tkr_tableYpos + " _ " + i_tkr_tableXpos , columns = ticker_cells , rows = 1 , bgcolor = i_tkr_tbl_bg_color , frame_width = i_tkr_tbl_frame_width , frame_color = i_tkr_tbl_border_color , border_width = i_tkr_tbl_border_width , border_color = i_tkr_tbl_border_color )
if ticker_cells == 2
// Populate cells in table
table . cell ( tickerTable , column = 0 , row = 0 , text = str . tostring ( syminfo . ticker ), text_color = i_tkr_tbl_symbol_text_color , text_size = tkr_tbl_symbol_text_size )
table . cell ( tickerTable , column = 1 , row = 0 , text = str . tostring ( timeframe_text_function ( timeframe . period )), text_color = i_tkr_tbl_timeframe_text_color , text_size = tkr_tbl_timeframe_text_size )
if ticker_cells == 1
// Populate cell in table
if i_tkr_tbl_symbol_toggle == 1
table . cell ( tickerTable , column = 0 , row = 0 , text = str . tostring ( syminfo . ticker ), text_color = i_tkr_tbl_symbol_text_color , text_size = tkr_tbl_symbol_text_size )
else
table . cell ( tickerTable , column = 0 , row = 0 , text = str . tostring ( timeframe_text_function ( timeframe . period )), text_color = i_tkr_tbl_timeframe_text_color , text_size = tkr_tbl_timeframe_text_size )