I'm trying to get the RSI to appear at the Pivot highs, but I can't figure out how to do it... it's always offset... I'm trying to use the code:
rsiVal = rsi(close, 14)
to get the RSI and
label.new(bar_index, na, text=tostring(rsiVal), color=color.red, textcolor=color.white, style=label.style_label_up, yloc=yloc.belowbar)
to add the label.
Can you help me with the final piece to this puzzle?
timeHigh - length, lastHigh,
timeLow - length, lastLow,
xloc.bar_index, color=_li_color, width=2
It contains coordinates of pivot points
After your declaration of the 6 var's, I added:
var rsiVal = 0.0
if high > lastHigh
rsiVal := round(rsi(close, 14))
Then under the 'if dirup' line I added this to display the label:
label.new(timeHigh-length, na, text=tostring(rsiVal), color=color.red, textcolor=color.white, style=label.style_label_down, yloc=yloc.abovebar)
It's weird because the value displayed in the label isn't even an RSI value anywhere within the vicinity of the pivot high - I don't know where that value is coming from.
Again, I appreciate your help! -Anthony
you need to change rsiVal calculation to somethink like this
rsiVal := (rsi(close, 14))(length)
use square brackets around length (TV does not allow to use them in comment)