OPEN-SOURCE SCRIPT
Pivot Points [DecodingFlowLab]

Pivot Points [DecodingFlowLab]
A clean and lightweight pivot structure indicator designed to detect significant swing highs and swing lows directly from market structure.
This tool uses a symmetric pivot detection model based on a configurable depth value to identify confirmed turning points in price action.
━━━━━━━━━━━━━━
How It Works
━━━━━━━━━━━━━━
• The indicator scans both sides of the candle using the selected “Depth” value.
• A Pivot High is confirmed only when the candle’s high is greater than the highs of surrounding candles.
• A Pivot Low is confirmed only when the candle’s low is lower than the lows of surrounding candles.
• Signals are plotted only after confirmation to reduce market noise and false swings.
━━━━━━━━━━━━━━
Smart Filtering Logic
━━━━━━━━━━━━━━
The script includes an internal directional filtering mechanism:
• If a new higher pivot high appears, the previous pivot high is automatically replaced.
• If a new lower pivot low appears, the previous pivot low is replaced as well.
This creates a cleaner market structure view and prevents unnecessary duplicate pivots.
━━━━━━━━━━━━━━
Features
━━━━━━━━━━━━━━
✔ Clean visual swing detection
✔ Dynamic replacement of weaker pivots
✔ Adjustable pivot sensitivity using “Depth”
✔ Offset plotting to avoid candle overlap
✔ Lightweight and optimized
✔ Useful for market structure analysis
✔ Can assist with:
• Swing Trading
• Trend Analysis
• Liquidity Mapping
• BOS / CHOCH concepts
• Support & Resistance identification
━━━━━━━━━━━━━━
Inputs
━━━━━━━━━━━━━━
• Depth
Controls pivot sensitivity.
Higher values = stronger but fewer pivots.
• plotShift
Moves pivot markers away from candles for better chart visibility.
• Pivot Colors
Custom colors for highs and lows.
━━━━━━━━━━━━━━
Best Use Cases
━━━━━━━━━━━━━━
This indicator works especially well for:
• Market Structure traders
• Smart Money Concept (SMC) traders
• Swing traders
• Liquidity-based analysis
• Manual chart markup
━━━━━━━━━━━━━━
Important Note
━━━━━━━━━━━━━━
Because pivots require future candle confirmation, signals appear after the structure is confirmed.
This behavior is intentional and helps filter out weak or temporary swings.
Built by DecodingFlowLab.
Disclaimer
This indicator is provided for educational and informational purposes only and should not be considered financial advice, investment advice, or a recommendation to buy or sell any financial instrument.
The indicator does not provide guaranteed entry or exit signals for trading positions. Financial markets involve significant risk, and past performance does not guarantee future results.
Users are solely responsible for their own trading decisions, risk management, and use of this indicator in any market or trading environment.
The publisher, developer, and distributor of this indicator assume no responsibility or liability for any financial losses, damages, or outcomes resulting from the use or misuse of this indicator.
A clean and lightweight pivot structure indicator designed to detect significant swing highs and swing lows directly from market structure.
This tool uses a symmetric pivot detection model based on a configurable depth value to identify confirmed turning points in price action.
━━━━━━━━━━━━━━
How It Works
━━━━━━━━━━━━━━
• The indicator scans both sides of the candle using the selected “Depth” value.
• A Pivot High is confirmed only when the candle’s high is greater than the highs of surrounding candles.
• A Pivot Low is confirmed only when the candle’s low is lower than the lows of surrounding candles.
• Signals are plotted only after confirmation to reduce market noise and false swings.
━━━━━━━━━━━━━━
Smart Filtering Logic
━━━━━━━━━━━━━━
The script includes an internal directional filtering mechanism:
• If a new higher pivot high appears, the previous pivot high is automatically replaced.
• If a new lower pivot low appears, the previous pivot low is replaced as well.
This creates a cleaner market structure view and prevents unnecessary duplicate pivots.
━━━━━━━━━━━━━━
Features
━━━━━━━━━━━━━━
✔ Clean visual swing detection
✔ Dynamic replacement of weaker pivots
✔ Adjustable pivot sensitivity using “Depth”
✔ Offset plotting to avoid candle overlap
✔ Lightweight and optimized
✔ Useful for market structure analysis
✔ Can assist with:
• Swing Trading
• Trend Analysis
• Liquidity Mapping
• BOS / CHOCH concepts
• Support & Resistance identification
━━━━━━━━━━━━━━
Inputs
━━━━━━━━━━━━━━
• Depth
Controls pivot sensitivity.
Higher values = stronger but fewer pivots.
• plotShift
Moves pivot markers away from candles for better chart visibility.
• Pivot Colors
Custom colors for highs and lows.
━━━━━━━━━━━━━━
Best Use Cases
━━━━━━━━━━━━━━
This indicator works especially well for:
• Market Structure traders
• Smart Money Concept (SMC) traders
• Swing traders
• Liquidity-based analysis
• Manual chart markup
━━━━━━━━━━━━━━
Important Note
━━━━━━━━━━━━━━
Because pivots require future candle confirmation, signals appear after the structure is confirmed.
This behavior is intentional and helps filter out weak or temporary swings.
Built by DecodingFlowLab.
Disclaimer
This indicator is provided for educational and informational purposes only and should not be considered financial advice, investment advice, or a recommendation to buy or sell any financial instrument.
The indicator does not provide guaranteed entry or exit signals for trading positions. Financial markets involve significant risk, and past performance does not guarantee future results.
Users are solely responsible for their own trading decisions, risk management, and use of this indicator in any market or trading environment.
The publisher, developer, and distributor of this indicator assume no responsibility or liability for any financial losses, damages, or outcomes resulting from the use or misuse of this indicator.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.