RNB
RNB

Reputation: 39

Change script to react to Hover state

Currently this table only reads the current and previous candles data, but I would also like the option for it to read what ever candle I hover over.

So for example if I go back to the 10th candle the values will change according to the that 10th candle and if I don't hover over any candle it goes back to the current and previous candle again.

Here is a visual example of what I am looking for:

Here is a visual example of what I am looking for.

Below is the script...

//@version=5
indicator("Contract Size Table", precision=0)

plot(100/(high - low)/100, transp=100)
plot(100/(high[1]-low[1])/100, transp=100) 

curr = 100/(high - low)/100
prev = 100/(high[1]-low[1])/100

var testTable = table.new(position = position.bottom_right, columns = 2, rows = 2, border_width = 1)
if barstate.islast
    table.cell(table_id = testTable, column = 1, row = 0, text = " " + str.tostring( math.round(curr,0)),text_color=color.yellow, text_size= size.large)
    table.cell(table_id = testTable, column = 1, row = 1, text = " " + str.tostring(math.round(prev,0)), text_color=color.blue, text_size= size.large)

Upvotes: 1

Views: 721

Answers (1)

Bjorgum
Bjorgum

Reputation: 2310

This is not currently a feature unfortunately. You cannot reference the cursor within in a script in this manner by just hovering and having those values be detected.

There is a data window that displays all plotted values however. It’s third selection down below your watchlist on browser

Upvotes: 1

Related Questions