OPEN-SOURCE SCRIPT
Smart Pivot Reversals [identityKa]

Overview
The Smart Pivot Reversals [identityKa] is a structural Price Action indicator designed to automatically detect and highlight market swing highs (Tops) and swing lows (Bottoms). Instead of relying on lagging moving averages to find reversals, this script uses raw bar-by-bar analysis to identify local structural extremes. To increase signal reliability, it includes optional, mathematically strict filters for macro-trend alignment and momentum exhaustion.
Underlying Concepts & Calculations
At its core, the indicator utilizes the standard ta.pivothigh and ta.pivotlow functions. The detection mechanism is entirely governed by two user-defined parameters:
Left Bars (Sensitivity): The number of preceding bars that must have a lower high (for a Top) or a higher low (for a Bottom). A smaller number detects micro-swings, while a larger number identifies major structural points.
Right Bars (Confirmation): The number of subsequent bars required to validate the pivot. Note on Visualization: The script uses a negative offset equal to the "Right Bars" value. This means the "TOP" or "BOTTOM" label is plotted exactly on the pivot candle historically, only after the confirmation bars have closed.
Smart Validation Filters (Optional Logic)
To filter out noise in ranging markets, traders can enable two concurrent mathematical filters:
Macro Trend Filter (EMA): When activated, the script calculates a standard Exponential Moving Average (default length 200). A pivot low (Bottom) is only validated if the closing price is strictly above the EMA (identifying pullbacks in an uptrend). A pivot high (Top) is only validated if the closing price is strictly below the EMA.
Momentum Strict Mode (RSI): When activated, the script checks the Relative Strength Index (default length 14) at the exact moment the pivot is confirmed. A Top is only valid if the RSI is in the Overbought zone (≥70). A Bottom is only valid if the RSI is in the Oversold zone (≤30).
HUD Dashboard & State Tracker
The script features a built-in, customizable on-chart panel that aggregates the last confirmed structural pivot and outputs an AI-style state suggestion:
LONG: Triggered and sustained when the last confirmed structure was a valid BOTTOM.
SHORT: Triggered and sustained when the last confirmed structure was a valid TOP.
Dangerous: Displayed during periods of transition or neutral states before a definitive structure is confirmed.
How to Use It
This tool is highly effective for traders utilizing Price Action methodologies, particularly on intraday charts (such as 15-minute or 1-hour timeframes). The printed Top/Bottom labels serve as excellent objective points for drawing support/resistance zones or trendlines. Traders can use the optional EMA and RSI filters to mechanically ignore counter-trend setups and only focus on high-probability reversal structures that align with the broader market context.
The Smart Pivot Reversals [identityKa] is a structural Price Action indicator designed to automatically detect and highlight market swing highs (Tops) and swing lows (Bottoms). Instead of relying on lagging moving averages to find reversals, this script uses raw bar-by-bar analysis to identify local structural extremes. To increase signal reliability, it includes optional, mathematically strict filters for macro-trend alignment and momentum exhaustion.
Underlying Concepts & Calculations
At its core, the indicator utilizes the standard ta.pivothigh and ta.pivotlow functions. The detection mechanism is entirely governed by two user-defined parameters:
Left Bars (Sensitivity): The number of preceding bars that must have a lower high (for a Top) or a higher low (for a Bottom). A smaller number detects micro-swings, while a larger number identifies major structural points.
Right Bars (Confirmation): The number of subsequent bars required to validate the pivot. Note on Visualization: The script uses a negative offset equal to the "Right Bars" value. This means the "TOP" or "BOTTOM" label is plotted exactly on the pivot candle historically, only after the confirmation bars have closed.
Smart Validation Filters (Optional Logic)
To filter out noise in ranging markets, traders can enable two concurrent mathematical filters:
Macro Trend Filter (EMA): When activated, the script calculates a standard Exponential Moving Average (default length 200). A pivot low (Bottom) is only validated if the closing price is strictly above the EMA (identifying pullbacks in an uptrend). A pivot high (Top) is only validated if the closing price is strictly below the EMA.
Momentum Strict Mode (RSI): When activated, the script checks the Relative Strength Index (default length 14) at the exact moment the pivot is confirmed. A Top is only valid if the RSI is in the Overbought zone (≥70). A Bottom is only valid if the RSI is in the Oversold zone (≤30).
HUD Dashboard & State Tracker
The script features a built-in, customizable on-chart panel that aggregates the last confirmed structural pivot and outputs an AI-style state suggestion:
LONG: Triggered and sustained when the last confirmed structure was a valid BOTTOM.
SHORT: Triggered and sustained when the last confirmed structure was a valid TOP.
Dangerous: Displayed during periods of transition or neutral states before a definitive structure is confirmed.
How to Use It
This tool is highly effective for traders utilizing Price Action methodologies, particularly on intraday charts (such as 15-minute or 1-hour timeframes). The printed Top/Bottom labels serve as excellent objective points for drawing support/resistance zones or trendlines. Traders can use the optional EMA and RSI filters to mechanically ignore counter-trend setups and only focus on high-probability reversal structures that align with the broader market context.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。