[GTH] Relative Strength, Sectors
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © gehteha

//@version=5
indicator(title="[GTH] Relative Strength, Sector", overlay= false)

sector = input.string(defval="SPX", title="Sector", options=["SPX", "NDX", "XLB", "XLC", "XLE", "XLF", "XLI", "XLK", "XLP", "XLRE", "XLU", "XLV", "XLY", "XBI", "XHE", "XPH", "XHS", "XOP", "XES", "XRT", "XHB", "XSD", "XSW", "XTL", "XTN", "XAR", "KIE", "CIBR", "SPYG", "SPYV"])
switch_os = input.bool(title="Use this symbol instead", defval=false, inline="1")
other_sym = input.symbol("", title="", inline="1")

per = input.int(title="Smoothing Period", defval=21, minval=1)

org_sym = request.security(syminfo.tickerid, timeframe.period, close)

comp_sym = switch_os == true ? other_sym : sector

s = request.security(comp_sym, timeframe.period, close)

plot(ta.linreg(org_sym/s, per, 0), linewidth=2, color=#ff00df)