Quad RS
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © InvestIn10

//@version=5
indicator("Quad RS", shorttitle="Quad RS", timeframe="")

sym = input.symbol("NSE:NIFTY", "Relative Symbol")
period1 = input.int(500, "Period 1")
period2 = input.int(250, "Period 2")
period3 = input.int(125, "Period 3")
period4 = input.int(63, "Period 4")

baseSym = request.security(syminfo.tickerid, timeframe.period, close)
rel = request.security(sym, timeframe.period, close)

rs1 = (baseSym / baseSym[period1]) / (rel / rel[period1]) - 1
rs2 = (baseSym / baseSym[period2]) / (rel / rel[period2]) - 1
rs3 = (baseSym / baseSym[period3]) / (rel / rel[period3]) - 1
rs4 = (baseSym / baseSym[period4]) / (rel / rel[period4]) - 1

hline(0)   
plot(rs1, color=color.rgb(12, 107, 202), title="RS 1")
plot(rs2, color=color.rgb(25, 143, 12), title="RS 2")
plot(rs3, color=color.orange, title="RS 3")
plot(rs4, color=color.red, title="RS 4")


