Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
1.4 kB
5
Indexable
Never
// © wood42

//@version=4
study("WOOD MAGIC RSI", shorttitle="WOOD MAGIC RSI", overlay=false)
i_showRsi = input(true, "Show RSI", group="RSI's", tooltip="Show RSI of current pair.")
i_showrsiBtc = input(true, "Show BTC's RSI", group="RSI's", tooltip="Show BTCUSD RSI")
rsiLen = input(14, "Length", group="RSI's", inline="rsi1")
rsiSrc = input(close, "| Source", group="RSI's", inline="rsi1")

btcSrc = security('BTCUSD', resolution=timeframe.period, expression=close)
ethSrc = security('ETHUSD', resolution=timeframe.period, expression=close)

rsi = rsi(rsiSrc, rsiLen)
rsiBtc = rsi(btcSrc, rsiLen)
rsiEth = rsi(ethSrc, rsiLen)

fillClr = rsi >= rsiBtc ? color.new(#000000, 85) : color.new(#ff33d3, 85)
fillClr2 = rsi >= ethSrc ? color.new(#444444, 85) : color.new(#ff33d3, 85)

p1 = plot(i_showRsi ? rsi : na, "RSI", color=color.new(#000000, 0))
p2 = plot(i_showrsiBtc ? rsiBtc : na, "BTC's RSI", color=color.new(#ff33d3,40))
p3 = plot(i_showrsiBtc ? rsiEth : na, "Eth's RSI", color=color.new(#888888,40))
fill(p1, p2, color=fillClr, title="RSI Fill Color")


OB = hline(70, title="Overbought", color=color.new(#d9d9d9, 20), linestyle=hline.style_dashed)
OS = hline(30, title="Oversold", color=color.new(#d9d9d9, 20), linestyle=hline.style_dashed)
hline(50, title="Middle Line", color=color.new(#d9d9d9, 70), linestyle=hline.style_dashed)
fill(OB, OS, color=color.gray, title="Between OB/OS")