OPEN-SOURCE SCRIPT
RSI Zones Background + Optional RSI Pane

Overview
This Pine Script indicator does two things at once:
Colors the background of the main price chart whenever the RSI value is below a lower threshold (default 30) or above an upper threshold (default 70). This highlights oversold and overbought zones directly on the price chart itself.
Optionally displays a separate RSI panel with the RSI line and shaded region between the two threshold levels for reference.
The indicator is fully customizable through the settings panel—color choices, transparency, and whether to show the separate RSI pane can all be adjusted.
Key Parts of the Code
1. Inputs
src: The source price series for RSI calculation.
len: RSI lookback length (default 14).
lowerThr and upperThr: The lower and upper thresholds (defaults: 30 and 70).
lowColor and highColor: Colors for the background when RSI is below or above the thresholds.
bgTrans: Transparency level for the background shading.
showRSI: Boolean to toggle the optional RSI pane on or off.
2. RSI Calculation
rsi = ta.rsi(src, len)
This computes the RSI from the chosen price source.
3. Background Coloring on the Price Chart
bgCol = rsi <= lowerThr ? color.new(lowColor,bgTrans) :
rsi >= upperThr ? color.new(highColor,bgTrans) :
na
bgcolor(bgCol)
If RSI ≤ lower threshold: background turns lowColor (oversold zone).
If RSI ≥ upper threshold: background turns highColor (overbought zone).
Otherwise, no background color.
4. Optional RSI Pane
plot(showRSI ? rsi : na, display=display.pane)
Plots the RSI line in a separate pane when showRSI is true; otherwise hides it.
5. Horizontal Lines for Thresholds
hLower = hline(lowerThr, ...)
hUpper = hline(upperThr, ...)
Two horizontal lines at the lower and upper thresholds.
Because hline() can’t be wrapped inside if blocks, the script always creates them but makes them transparent (using na color) when the pane is hidden.
6. Filling Between Threshold Lines
fill(hLower, hUpper, color=showRSI ? color.new(color.gray,95) : na)
When the RSI pane is visible, the area between the two threshold lines is shaded in gray to create a “mid-zone” effect. This fill also switches off (becomes na) if the pane is hidden.
7. Alerts
The script also includes two alert conditions:
When RSI crosses below the lower threshold.
When RSI crosses above the upper threshold.
How It Works in Practice
On the price chart, you’ll see the background turn blue (or your chosen color) when RSI is ≤30, and red when RSI is ≥70.
If you enable “Show RSI” in the settings, a separate RSI pane will appear below the price chart, plotting the RSI line with two threshold lines and a shaded region in between.
You can fully adjust transparency and colors to suit your chart style.
Benefits
Quickly visualize overbought and oversold conditions without opening a separate RSI window.
Optional RSI pane provides context when needed.
Customizable colors and transparency make it easy to integrate with any chart theme.
Alerts give you automatic notifications when RSI crosses key levels.
------------------------------------------------------------------------------------------------------------------
개요
이 지표는 두 가지 기능을 동시에 수행합니다.
가격 차트 뒤 배경에 색상 표시
RSI 값이 설정한 하단 임계값(기본 30) 이하이거나 상단 임계값(기본 70) 이상일 때, 가격 차트 뒤쪽에 과매도·과매수 구간을 색으로 표시해줍니다.
선택적으로 RSI 보조창 표시
옵션을 켜면 별도의 RSI 패널이 나타나서 RSI 라인과 두 임계값(30, 70)을 연결한 구간을 음영 처리하여 보여줍니다.
설정 창에서 색상·투명도·보조창 표시 여부를 전부 조정할 수 있습니다.
코드 핵심 설명
1. 입력값
src: RSI 계산에 사용할 가격 소스(기본 종가).
len: RSI 기간(기본 14).
lowerThr / upperThr: RSI 하단·상단 임계값(기본 30, 70).
lowColor / highColor: RSI가 각각 하단 이하·상단 이상일 때 배경 색상.
bgTrans: 배경 투명도(0=불투명, 100=투명).
showRSI: RSI 보조창을 켜고 끌 수 있는 스위치.
2. RSI 계산
rsi = ta.rsi(src, len)
지정한 가격 소스를 기반으로 RSI를 계산합니다.
3. 가격 차트 배경 색칠
bgCol = rsi <= lowerThr ? color.new(lowColor,bgTrans) :
rsi >= upperThr ? color.new(highColor,bgTrans) :
na
bgcolor(bgCol)
RSI ≤ 하단 임계값 → lowColor(과매도 색)
RSI ≥ 상단 임계값 → highColor(과매수 색)
나머지 구간은 색상 없음.
4. 선택적 RSI 보조창
plot(showRSI ? rsi : na, display=display.pane)
showRSI가 켜져 있으면 RSI 라인을 보조창에 표시하고, 꺼져 있으면 숨깁니다.
5. 임계값 가로선
hLower = hline(lowerThr, ...)
hUpper = hline(upperThr, ...)
하단·상단 임계값을 가로선으로 표시합니다.
hline은 if 블록 안에서 쓸 수 없기 때문에 항상 그려지지만, 보조창이 꺼지면 색을 na로 처리해 안 보이게 합니다.
6. 임계값 사이 영역 음영 처리
fill(hLower, hUpper, color=showRSI ? color.new(color.gray,95) : na)
보조창이 켜져 있을 때만 두 가로선 사이를 회색으로 채워 “중립 구간”을 강조합니다.
7. 알림 조건
RSI가 하단 임계값을 아래로 돌파할 때 알림.
RSI가 상단 임계값을 위로 돌파할 때 알림.
실제 작동 모습
가격 차트 뒤쪽에 RSI ≤30이면 파란색, RSI ≥70이면 빨간색 배경이 나타납니다(색상은 설정에서 변경 가능).
RSI 보조창을 켜면, RSI 라인과 임계값 가로선, 그리고 그 사이 음영 영역이 함께 나타납니다.
투명도를 높이거나 낮추어 강조 정도를 조절할 수 있습니다.
장점
별도의 RSI창을 열지 않고도 가격 차트 배경만으로 과매수·과매도 상태를 직관적으로 확인 가능.
필요하면 보조창으로 RSI를 직접 확인하면서 임계값 가이드와 음영 영역을 함께 볼 수 있음.
색상·투명도를 자유롭게 조절할 수 있어 차트 스타일에 맞게 커스터마이징 가능.
RSI가 임계값을 돌파할 때 자동 알림을 받을 수 있음.
This Pine Script indicator does two things at once:
Colors the background of the main price chart whenever the RSI value is below a lower threshold (default 30) or above an upper threshold (default 70). This highlights oversold and overbought zones directly on the price chart itself.
Optionally displays a separate RSI panel with the RSI line and shaded region between the two threshold levels for reference.
The indicator is fully customizable through the settings panel—color choices, transparency, and whether to show the separate RSI pane can all be adjusted.
Key Parts of the Code
1. Inputs
src: The source price series for RSI calculation.
len: RSI lookback length (default 14).
lowerThr and upperThr: The lower and upper thresholds (defaults: 30 and 70).
lowColor and highColor: Colors for the background when RSI is below or above the thresholds.
bgTrans: Transparency level for the background shading.
showRSI: Boolean to toggle the optional RSI pane on or off.
2. RSI Calculation
rsi = ta.rsi(src, len)
This computes the RSI from the chosen price source.
3. Background Coloring on the Price Chart
bgCol = rsi <= lowerThr ? color.new(lowColor,bgTrans) :
rsi >= upperThr ? color.new(highColor,bgTrans) :
na
bgcolor(bgCol)
If RSI ≤ lower threshold: background turns lowColor (oversold zone).
If RSI ≥ upper threshold: background turns highColor (overbought zone).
Otherwise, no background color.
4. Optional RSI Pane
plot(showRSI ? rsi : na, display=display.pane)
Plots the RSI line in a separate pane when showRSI is true; otherwise hides it.
5. Horizontal Lines for Thresholds
hLower = hline(lowerThr, ...)
hUpper = hline(upperThr, ...)
Two horizontal lines at the lower and upper thresholds.
Because hline() can’t be wrapped inside if blocks, the script always creates them but makes them transparent (using na color) when the pane is hidden.
6. Filling Between Threshold Lines
fill(hLower, hUpper, color=showRSI ? color.new(color.gray,95) : na)
When the RSI pane is visible, the area between the two threshold lines is shaded in gray to create a “mid-zone” effect. This fill also switches off (becomes na) if the pane is hidden.
7. Alerts
The script also includes two alert conditions:
When RSI crosses below the lower threshold.
When RSI crosses above the upper threshold.
How It Works in Practice
On the price chart, you’ll see the background turn blue (or your chosen color) when RSI is ≤30, and red when RSI is ≥70.
If you enable “Show RSI” in the settings, a separate RSI pane will appear below the price chart, plotting the RSI line with two threshold lines and a shaded region in between.
You can fully adjust transparency and colors to suit your chart style.
Benefits
Quickly visualize overbought and oversold conditions without opening a separate RSI window.
Optional RSI pane provides context when needed.
Customizable colors and transparency make it easy to integrate with any chart theme.
Alerts give you automatic notifications when RSI crosses key levels.
------------------------------------------------------------------------------------------------------------------
개요
이 지표는 두 가지 기능을 동시에 수행합니다.
가격 차트 뒤 배경에 색상 표시
RSI 값이 설정한 하단 임계값(기본 30) 이하이거나 상단 임계값(기본 70) 이상일 때, 가격 차트 뒤쪽에 과매도·과매수 구간을 색으로 표시해줍니다.
선택적으로 RSI 보조창 표시
옵션을 켜면 별도의 RSI 패널이 나타나서 RSI 라인과 두 임계값(30, 70)을 연결한 구간을 음영 처리하여 보여줍니다.
설정 창에서 색상·투명도·보조창 표시 여부를 전부 조정할 수 있습니다.
코드 핵심 설명
1. 입력값
src: RSI 계산에 사용할 가격 소스(기본 종가).
len: RSI 기간(기본 14).
lowerThr / upperThr: RSI 하단·상단 임계값(기본 30, 70).
lowColor / highColor: RSI가 각각 하단 이하·상단 이상일 때 배경 색상.
bgTrans: 배경 투명도(0=불투명, 100=투명).
showRSI: RSI 보조창을 켜고 끌 수 있는 스위치.
2. RSI 계산
rsi = ta.rsi(src, len)
지정한 가격 소스를 기반으로 RSI를 계산합니다.
3. 가격 차트 배경 색칠
bgCol = rsi <= lowerThr ? color.new(lowColor,bgTrans) :
rsi >= upperThr ? color.new(highColor,bgTrans) :
na
bgcolor(bgCol)
RSI ≤ 하단 임계값 → lowColor(과매도 색)
RSI ≥ 상단 임계값 → highColor(과매수 색)
나머지 구간은 색상 없음.
4. 선택적 RSI 보조창
plot(showRSI ? rsi : na, display=display.pane)
showRSI가 켜져 있으면 RSI 라인을 보조창에 표시하고, 꺼져 있으면 숨깁니다.
5. 임계값 가로선
hLower = hline(lowerThr, ...)
hUpper = hline(upperThr, ...)
하단·상단 임계값을 가로선으로 표시합니다.
hline은 if 블록 안에서 쓸 수 없기 때문에 항상 그려지지만, 보조창이 꺼지면 색을 na로 처리해 안 보이게 합니다.
6. 임계값 사이 영역 음영 처리
fill(hLower, hUpper, color=showRSI ? color.new(color.gray,95) : na)
보조창이 켜져 있을 때만 두 가로선 사이를 회색으로 채워 “중립 구간”을 강조합니다.
7. 알림 조건
RSI가 하단 임계값을 아래로 돌파할 때 알림.
RSI가 상단 임계값을 위로 돌파할 때 알림.
실제 작동 모습
가격 차트 뒤쪽에 RSI ≤30이면 파란색, RSI ≥70이면 빨간색 배경이 나타납니다(색상은 설정에서 변경 가능).
RSI 보조창을 켜면, RSI 라인과 임계값 가로선, 그리고 그 사이 음영 영역이 함께 나타납니다.
투명도를 높이거나 낮추어 강조 정도를 조절할 수 있습니다.
장점
별도의 RSI창을 열지 않고도 가격 차트 배경만으로 과매수·과매도 상태를 직관적으로 확인 가능.
필요하면 보조창으로 RSI를 직접 확인하면서 임계값 가이드와 음영 영역을 함께 볼 수 있음.
색상·투명도를 자유롭게 조절할 수 있어 차트 스타일에 맞게 커스터마이징 가능.
RSI가 임계값을 돌파할 때 자동 알림을 받을 수 있음.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.