OPEN-SOURCE SCRIPT

EMA with RSI Color (Custom Lengths)

201
本指标将指数移动平均线(EMA)与相对强弱指标(RSI)相结合,用于辅助判断市场的趋势方向与超买 / 超卖状态。
用户可自定义 EMA 的长度(如 20 / 60 / 120),并灵活选择 EMA 的计算周期:
(1) 使用当前图表周期,或
(2) 使用指定的高 / 低周期(如 1m、5m、1h、4h、1D、1W)

RSI 默认采用 14 周期,并支持自定义超买与超卖阈值:
(1) 当 RSI 低于超卖阈值(如 30)时,对应时间段内的 EMA 将自动变为绿色,提示可能存在超卖反弹机会;
(2) 当 RSI 高于超买阈值(如 70)时,对应时间段内的 EMA 将自动变为红色,提示可能存在超买回调风险;
(3) 当 RSI 处于中性区间时,EMA 显示为用户设定的默认颜色。

此外,RSI 的计算周期也可选择:
(1) 与 EMA 使用相同的周期(用于多周期趋势确认),或
(2) 使用当前图表周期(用于短周期动量判断)。

This indicator combines Exponential Moving Averages (EMA) with the Relative Strength Index (RSI) to assist in identifying trend direction and overbought/oversold conditions.
Users can define custom EMA lengths (e.g., 20 / 60 / 120) and flexibly choose the EMA calculation timeframe:
(1) Use the current chart timeframe, or
(2) Use a specified higher or lower timeframe (e.g., 1m, 5m, 1h, 4h, 1D, 1W).

The RSI uses a default 14-period setting, with customizable overbought and oversold levels:
(1) When RSI falls below the oversold threshold (e.g., 30), the EMA segments corresponding to that period are automatically colored green, indicating potential oversold rebound opportunities;
(2) When RSI rises above the overbought threshold (e.g., 70), the EMA segments turn red, signaling potential overbought pullback risk;
(3) When RSI remains within the neutral zone, EMA lines retain their user-defined default colors.

The RSI calculation timeframe can also be selected:
(1) The same timeframe as EMA (for multi-timeframe trend confirmation), or
(2) The current chart timeframe (for short-term momentum analysis).

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.