QuantitativeExhaustion

[RS][JR]RSI Price Bands

RSI Price Bands
By Ricardo Santos and JR

Have you ever wondered what RSI would look like as a Band? Well here it is. First premier Trading View special, RSI Price Band. Red shows overbought and Green shows oversold. You can also adjust what levels you prefer for overbought and oversold, and what additional RSI lengths you would like to see displayed on the chart..
Mã nguồn mở

Với tinh thần TradingView, tác giả của tập lệnh này đã xuất bản nó dưới dạng mã nguồn mở, vì vậy các nhà giao dịch có thể hiểu và xác minh nó. Chúc mừng tác giả! Bạn có thể sử dụng mã này miễn phí, nhưng việc sử dụng lại mã này trong một ấn phẩm chịu sự điều chỉnh của Nội quy nội bộ. Bạn có thể yêu thích nó để sử dụng nó trên biểu đồ.

Thông báo miễn trừ trách nhiệm

Thông tin và ấn phẩm không có nghĩa là và không cấu thành, tài chính, đầu tư, kinh doanh, hoặc các loại lời khuyên hoặc khuyến nghị khác được cung cấp hoặc xác nhận bởi TradingView. Đọc thêm trong Điều khoản sử dụng.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?
study("[RS][JR]RSI Price Bands", overlay=true)

//  ||--------------------------------------------------------------------------------------------------------------------------||
//  ||---   INPUTS:     --------------------------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------||
src = input(defval=hlc3, type=source, title="Source Series to be Used:")

showRSI1 = input(defval=true, type=bool, title="Show RSI Line 1?")
showRSI2 = input(defval=true, type=bool, title="Show RSI Line 2?")
showRSI3 = input(defval=true, type=bool, title="Show RSI Line 3?")

baseMA_length = input(defval=100, type=integer, minval=1, title="Bands Smoothness Period Length:")

fast_rsi_length = input(defval=7, type=integer, minval=1, title="Fast RSI Period Length:")
fast_smooth_length = input(defval=1, type=integer, minval=1, title="Fast RSI Smoothness Length:")
medium_rsi_length = input(defval=21, type=integer, minval=1, title="Medium RSI Period Length:")
medium_smooth_length = input(defval=1, type=integer, minval=1, title="Medium RSI Smoothness Length:")
slow_rsi_length = input(defval=50, type=integer, minval=1, title="Slow RSI Period Length:")
slow_smooth_length = input(defval=1, type=integer, minval=1, title="Slow RSI Smoothness Length:")

deviation_length = input(defval=2, type=integer, minval=1, title="Bands Tightness Period Length:")

showOBSFill = input(defval=true, type=bool, title="Show Over Bought/Sold Bands?")

//  ||--------------------------------------------------------------------------------------------------------------------------||
hh = highest(baseMA_length)
ll = lowest(baseMA_length)
//  ||--------------------------------------------------------------------------------------------------------------------------||
//  ||---   RSI to Price level conversion:     ---------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------||

baseMA = ema(avg(hh,ll), 10)//ema(src, baseMA_length)

capdev = cum(stdev(src, deviation_length)) / (n+1)

fastRSI = not showRSI1 ? na : ema(rsi(src, fast_rsi_length), fast_smooth_length)
mediumRSI = not showRSI2 ? na : ema(rsi(src, medium_rsi_length), medium_smooth_length)
slowRSI = not showRSI3 ? na : ema(rsi(src, slow_rsi_length), slow_smooth_length)

fastRSILine = not showRSI1 ? na : baseMA - (capdev*(50-fastRSI))
mediumRSILine = not showRSI2 ? na : baseMA - (capdev*(50-mediumRSI))
slowRSILine = not showRSI3 ? na : baseMA - (capdev*(50-slowRSI))

bl = plot(baseMA, color=black, title="Middle Line / RSI.50")

plot(not showRSI1 ? na : fastRSILine, color=blue, title="Fast RSI")
plot(not showRSI2 ? na : mediumRSILine, color=gray, title="Medium RSI")
plot(not showRSI3 ? na : slowRSILine, color=teal, title="Slow RSI")

//  ||--------------------------------------------------------------------------------------------------------------------------||
//  ||---   Over Bought/Sold Bands:     ----------------------------------------------------------------------------------------||
//  ||--------------------------------------------------------------------------------------------------------------------------||

OBLine = baseMA + (capdev*input(20))
OSLine = baseMA - (capdev*input(20))


ob1 = plot(not showOBSFill ? na : OBLine, color=black, style=circles, title="Over Bought Line")
os1 = plot(not showOBSFill ? na : OSLine, color=black, style=circles, title="Over Sold Line")

ob2 = plot(not showOBSFill ? na : baseMA + (capdev*50), color=black, style=circles, title="RSI.100 Line")
os2 = plot(not showOBSFill ? na : baseMA - (capdev*50), color=black, style=circles, title="RSI.0 Line")

fill(ob1, ob2, color=maroon, transp=90, title="Over Bought Fill")
fill(os1, os2, color=green, transp=90, title="Over Sold Fill")