The signals "RSI Buy" or "RSI Sell" appears directly above or below the bar and sometimes it's difficult to read it. Is it possible to change the position in the y-axis on the chart.
enter code here
//@version=4
study(title="Relative Strength Index", overlay=true, shorttitle="RSI Signals")
srcRSI = close
lenRSI = input(14, minval=1, title="Length")
//method color[enter image description here][1]
srcRSI1 = close
lenRSI1 = input(70, minval=1, title="RSI Up Standard")
srcRSI2 = close
lenRSI2 = input(30, minval=1, title="RSI Down Standard")
upRSI = rma(max(change(srcRSI), 0), lenRSI)
downRSI = rma(-min(change(srcRSI), 0), lenRSI)
rsiRSI = downRSI == 0 ? 100 : upRSI == 0 ? 0 : 100 - 100 / (1 + upRSI / downRSI)
isup() =>
rsiRSI[1] > lenRSI1 and rsiRSI <= lenRSI1
isdown() =>
rsiRSI[1] < lenRSI2 and rsiRSI >= lenRSI2
plotshape(isup(), color=#FF0000, style=shape.triangledown, text="RSI Sell", textcolor=#FF0000, location=location.abovebar, size=size.tiny)
plotshape(isdown(), color=#009900, style=shape.triangleup, text="RSI Buy", textcolor=#009900, location=location.belowbar, size=size.tiny)
Replace the plotshape()
's location=
arguments of with location.absolute
and add any y
(price) location for the label (high + atr(10)
/ low - atr(10)
), as is shown in the example below:
plotshape(isup()? high + atr(10) : na, color=#FF0000, style=shape.triangledown, text="RSI Sell", textcolor=#FF0000, location=location.absolute, size=size.tiny)
plotshape(isdown()? low - atr(10) : na, color=#009900, style=shape.triangleup, text="RSI Buy", textcolor=#009900, location=location.absolute, size=size.tiny)