OPEN-SOURCE SCRIPT

Market Structure

405
🏗️ Market Structure Indicator for TradingView (Pine Script v6)
Overview:

The Market Structure indicator is a robust tool for identifying swing highs and swing lows across multiple structural levels:

🟤 Short-Term Swings
🟠 Intermediate-Term Swings
🟢 Long-Term Swings

It helps traders visually interpret market structure by detecting confirmed pivot points and promoting them through a hierarchical system. This provides a clear picture of trend direction, breakouts, and reversals.

⚙️ Features and Functionality:
✅ Multi-level Swing Detection:
The indicator promotes confirmed swing points from short-term to intermediate and long-term levels using a structured algorithm.

✅ Full Customization:
Toggle visibility of each swing level independently.
Choose custom colors for short, intermediate, and long-term swings.
✅ Transparent and Commented Logic:
The code contains well-structured functions for identifying and confirming swing highs and lows.
Label arrays are used for precise control over swing detection and display.
✅ Detailed and Open Source Code:
Every function is thoroughly explained with inline comments.
Designed to be easy to understand, modify, and extend — perfect for learning or integrating into more advanced systems.

📜 Open and Documented Source Code
The script is entirely open-source, written in Pine Script v6, and includes full documentation inside the code itself. Key sections include:

🔧 Input settings and visual configuration
🧠 Swing detection and confirmation methods
🔁 Promotion logic between structure levels
📈 Real-time label drawing on each bar

Everything is fully accessible and explained — no obfuscation, no hidden logic.

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.