HTF Reversal Divergences [LuxAlgo]The HTF Reversal Divergences indicator is a multi-timeframe analysis tool that integrates higher timeframe (HTF) price action patterns, RSI divergences, and advanced candle projections (PO3) to identify potential market reversals.
🔶 USAGE
The indicator is designed to provide traders with a comprehensive view of market exhaustion and trend shifts by combining momentum oscillators with structural price patterns.
Users can monitor HTF candles (e.g., 1H, 4H) while trading on lower timeframes (e.g., 5m, 15m). When a reversal pattern like an Engulfing candle or a Pin Bar forms on the higher timeframe, the script highlights the specific area on the chart using styled boxes and labels.
🔹 RSI Divergences
The script calculates the Relative Strength Index (RSI) and automatically detects regular divergences. These are visualized with connecting lines on both the indicator pane and the main price chart:
Bullish Divergence : Occurs when price makes a lower low but the RSI makes a higher low, suggesting waning downward momentum.
Bearish Divergence : Occurs when price makes a higher high but the RSI makes a lower high, suggesting waning upward momentum.
🔹 Advanced HTF PO3 (Power of 3)
A unique feature of this tool is the projection of Higher Timeframe candles to the right of the current price action. This allows traders to see how the current lower-timeframe bars are contributing to the formation of the larger HTF candle (Open, High, Low, Close).
The PO3 projection includes a "Running Delta" which tracks volume-based buying and selling pressure within the current HTF period. Dashed lines connect the projected candle's OHLC levels back to the specific bars where those levels were established on the current timeframe.
🔶 DETAILS
The indicator uses request.security() to fetch data from the user-specified higher timeframe. The reversal patterns are defined as follows:
Engulfing : A candle that completely overlaps the body of the previous candle in the opposite direction.
Pin Bars : Hammers and Shooting Stars, defined by a long wick representing at least 60% of the total candle range.
The PO3 (Accumulation, Manipulation, Distribution) logic is reflected in the live candle projection, helping traders visualize where the "open" of the session is relative to current price, and whether the high or low of the HTF bar has likely been set.
🔶 SETTINGS
🔹 HTF Reversal Patterns
High Timeframe : Sets the timeframe used for pattern detection and candle projections.
Show Engulfing Patterns : Toggles the detection of bullish and bearish engulfing candles.
Show Pin Bars : Toggles the detection of Hammers and Shooting Stars.
Colors : Customize the visual representation of bullish and bearish structural patterns.
🔹 RSI Divergence
Show RSI Divergences : Toggles the calculation and display of momentum divergences.
RSI Length : The lookback period for the RSI calculation.
Pivot Lookbacks : Determines the sensitivity of the pivot detection used for finding divergence points.
🔹 Advanced: HTF PO3
Show HTF PO3 : Toggles the projected candle interface on the right side of the chart.
Candles to Show : The number of historical HTF candles to project alongside the live one.
Right Offset : How many bars to the right the projection is rendered.
Show PO3 Price Labels/Delta : Toggles specific data points on the projection UI.
Chỉ báo Pine Script®






















