RSI 1H/4H Multi-Level (REPAINT) - Hourly LimitRSI 1H/4H Multi-Level (REPAINT) – Hourly Limit is a Pine Script v5 indicator designed to monitor RSI level crossings on two higher timeframes (1H and 4H) while controlling alert frequency to avoid spam. The script can display visual dots on the chart and trigger a single consolidated alert message when either timeframe’s RSI crosses user-defined levels—limited to once per hour.
Key features
1) Dual timeframe RSI monitoring (1H + 4H)
Calculates RSI on 1-hour (60) and 4-hour (240) timeframes independently.
Each timeframe has its own configurable settings:
RSI Length
Lower level (commonly oversold, e.g., 30)
Upper level (commonly overbought, e.g., 70)
Dot color for chart marking
2) Multi-level cross detection
The indicator tracks when RSI crosses either boundary level:
1H RSI crosses its Lower or Upper level
4H RSI crosses its Lower or Upper level
A trigger occurs if any of these crossings happens.
3) Hourly alert limiter (anti-spam)
To prevent repeated alerts, the script includes an hourly cooldown:
It stores the start time of the last hour when an alert was fired.
A new alert can only fire when the current hour start time is greater than the last recorded one.
Result: maximum 1 alert per hour, even if multiple crossings occur within the same hour.
4) Consolidated alert message
When triggered, the script builds a single message that can include:
1H RSI value if the 1H crossing occurred
4H RSI value if the 4H crossing occurred
Example message format:
1H RSI (52.34) crossed level; 4H RSI (48.10) crossed level;
5) On-chart visualization with priority coloring
If enabled, the script plots a dot below the bar on trigger:
White dot if both 1H and 4H signals fired in the same hour
1H color if only 1H fired
4H color if only 4H fired
Important note: REPAINT behavior
This indicator intentionally uses request.security(..., lookahead=barmerge.lookahead_on), meaning it can repaint because it references higher-timeframe data with lookahead enabled. As a result:
Cross signals may appear earlier than they would in a non-repainting implementation.
Signals can change as the higher timeframe candle evolves.
Typical use cases
Monitoring overbought/oversold zone transitions on higher timeframes while trading lower timeframes.
Receiving fewer, cleaner alerts thanks to the hourly limit.
Quickly identifying whether a signal came from 1H, 4H, or both using dot colors.
Chỉ báo Pine Script®






















