OPEN-SOURCE SCRIPT

KEY LEVEL SMC - Order Block

497
The "KEY LEVEL SMC - Order Block" is a specialized institutional technical analysis tool optimized for TradingView v6. It automatically detects, highlights, and projects Order Blocks (OB) using strict algorithmic price action and structural efficiency logic.

This indicator is specifically engineered for traders utilizing Smart Money Concepts (SMC) and Order Flow mechanics to maintain an objective view of institutional supply and demand zones.

### 📐 How It Works (Algorithmic Logic):
Unlike standard engulfing indicators, this script applies a strict filter requiring the immediate displacement to leave a structural imbalance (Fair Value Gap/Inefficiency) behind. The signal evaluates a 3-candle sequence:

1. **Bullish Order Block Configuration:**
- The setup identifies a specific institutional down-candle followed by aggressive upward displacement.
- A valid signal is triggered only if the opening price of the current setup candle is within or below the previous candle's body, closes above the previous candle's open, and the subsequent candle's low fails to mitigate the high of the initial candle (confirming an immediate structural imbalance).
- **Zone Boundaries:** The automated box marks the lowest point between the two initial candles as the bottom zone, and the open price of the setup candle as the top zone.

2. **Bearish Order Block Configuration:**
- The setup tracks an institutional up-candle followed by sharp downward displacement.
- Trigger criteria mandate that the setup candle opens within or above the previous body, closes below the previous open, and the subsequent candle's high leaves an unmitigated gap below the previous candle's low.
- **Zone Boundaries:** The automated box spans from the highest point of the displacement candles to the open price of the setup candle.

### 💻 Key Features & Customization:
* **Dynamic Box Array Management:** The script utilizes dynamic arrays (`box[]`) to plot and track multiple historical zones simultaneously. To ensure peak chart performance without causing lag, it features an automated memory cleanup loop governed by the "Maximum Box Displayed" parameter.
* **Real-time Extensions:** Zones remain active and extend dynamically to the right with each new bar until the price action fully mitigates or invalidates the defined structural level.
* **Dark-Mode Optimized UI:** Built-in customized color groups allow traders to seamlessly adjust candle overlays and box transparencies to fit professional dark layout themes perfectly.

### 🛑 Disclaimer & Use Case:
This tool is intended for professional intraday and swing trading strategies across major pairs, indices, and metals. It works best when combined with higher-timeframe order flow alignment and key Fibonacci expansion target objectives.

כתב ויתור

המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.