TW1403

Mother

16
RSI Strategy
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
//Created By Aex1403 on 31/12/2015


study(title="Mother", shorttitle="Mother", precision=0)
src = close
len = input(9, minval=1, title="Length")
upLine = input(70, minval=50, maxval=90, title="Upper Line Value?")
lowLine = input(30, minval=10, maxval=50, title="Lower Line Value?")
sml = input(true, title="Show Mid Line?")
sbh = input(true, title="Show Back Ground Highlights When RSI is Above/Below High/Low Lines?")
sch = input(true, title="Show Back Ground Highlights When RSI Cross?")
apsbuy = input(true, title="Show Back Ground Highlights When 2nd RSI is Above Upper Line Value?")
apssell = input(true, title="Show Back Ground Highlights When 2nd RSI is Below Lower Line Value?")
useCurrentRes = input(true, title="Use Current Chart Resolution?")
resCustom = input(title="Use Different Timeframe? Uncheck Box Above", type=resolution, defval="60")
ssRSI = input(false, title="Show 2nd RSI?")
resCustom2 = input(title="Use 2nd RSI? Check Box Above", type=resolution, defval="D")
useCurrentRes2 = input(false, title="Use 2nd RSI Plot On Samet Timeframe?")
len2 = input(7, minval=1, title="2nd RSI Length")
res = useCurrentRes ? period : resCustom
res2 = useCurrentRes2 ? period : resCustom2

up = rma(max(change(src), 0), len)
down = rma(-min(change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
outRSI = security(tickerid, res, rsi)

up2 = rma(max(change(src), 0), len2)
down2 = rma(-min(change(src), 0), len2)
rsi2 = down2 == 0 ? 100 : up2 == 0 ? 0 : 100 - (100 / (1 + up2 / down2))
outRSI2 = security(tickerid, res2, rsi2)

aboveLine = outRSI > upLine ? 1 : 0
belowLine = outRSI < lowLine ? 1 : 0








plot(outRSI, title="RSI", style=line, linewidth=3, color=black)
plot(ssRSI and outRSI2 ? outRSI2 : na, title="2nd RSI - Different Time Frame?", style=linebr, linewidth=4, color=orange)
p1 = plot(upLine, title= "Upper Line", style=solid, linewidth=3, color=red)
p2 = plot(lowLine, title= "Lower Line", style=solid, linewidth=3, color=lime)