Smart Market Structure Suite
- Indicatori
- Versione: 3.0
- Attivazioni: 5
# Smart Market Structure Suite
The **Smart Market Structure Suite** is a technical analysis utility for MetaTrader 5 that integrates four distinct structural engines into a unified charting workspace. By combining structural high-low pivots, institutional order blocks with support-resistance flips, momentum-driven supply/demand zones, and divergence-proof oscillator levels, this utility helps traders identify key horizontal boundaries, order flow footprints, and structural transitions.
The engine has been designed from the ground up for high-performance terminal operation, utilizing localized array indexing and state preservation techniques to minimize memory footprint and avoid common terminal calculation lag.
---
## Core Analytical Modules ### 1. High-Low Pivot Engine (PivotsHL)
Detects structural swing highs and lows based on localized price geometry.
* **Early-Trigger Confirmation:** An optional leading confirmation mode verifies structural pivots ahead of standard lagging lookbacks by evaluating immediate candle closes relative to candidate pivot wicks.
* **Dual Visualization:** Supports both retroactive (TradingView style) labeling at the exact pivot candle and confirmation bar labeling (non-repaint/leading) to guide real-time execution.
* **Support & Resistance Channels:** Automatically projects horizontal pivot zones or flat S&R lines across the active trading session.
### 2. Leading Order Block & Breaker Engine Tracks institutional footprint zones formed by extreme candles preceding structural break movements.
* **No-Lag Architecture:** Implements a state-preservation algorithm that saves valid historical states on the close of each bar. This prevents dynamic intra-bar fluctuations from causing visual lag, chart freezing, or historical modifications.
* **S/R Breaker Flips:** Order blocks that are cleanly violated on a candle close are automatically recalculated and styled as "Breaker Blocks," identifying classic Support/Resistance flips.
* **Strict Imbalance & Fakeout Filtering:** Integrates strict filters including Fair Value Gap (FVG) validation, body-close market structure break requirements (to filter out wick traps), and extreme-candle selection methods.
* **Trade Level Projections:** Projects custom entry lines (such as the 50% equilibrium level) alongside risk-to-reward target lines (SL and TP) calculated dynamically from structural boundaries.
### 3. Supply & Demand Zone Tracking (Satya S&D) Identifies dynamic zones of market imbalance originating from high-momentum breakouts (impulse moves).
* **Impulse Strength Multiplier:** Automatically calculates the physical sizing of origin candle wicks and requires a user-defined expansion multiple before confirming a zone.
* **Real-Time Mitigation Monitoring:** Actively monitors current candle closes. If a supply zone is breached to the upside or a demand zone to the downside, the zone is flagged as mitigated and cleanly removed from the active view.
### 4. Awesome S/R Levels (Awesome Oscillator S/R) Generates major horizontal key levels mapped to high-probability swing peaks within the MetaTrader 5 native Awesome Oscillator.
* **Peak Confirmation Filter:** Analyzes 3-bar or 5-bar AO peak geometry, safely ignoring unconfirmed live bars.
* **Divergence-Proof Tracking:** Maps confirmed oscillator momentum peaks directly to their corresponding absolute price extremes, ensuring S&R projections are backed by physical market high/low prints rather than momentum alone.
## Key Technical Optimizations
* **Minimized Terminal Requests:** Replaces heavy terminal function calls (such as `iHigh()` or `iLow()`) inside calculation loops with highly efficient local array offset mapping, reducing CPU usage during manual chart analysis and strategy testing.
* **Unified Memory Cleanup:** Cleanly handles indicator initialization, deinitialization, and daily session transitions, ensuring no ghost graphics or memory leaks remain on the chart workspace.
## Input Parameters List & Descriptions
### === 1. Pivots High/Low Settings ===
* **Pivot High Left Length (`InpLeftLenH`):** The number of preceding bars required to establish a candidate swing high peak. (Must be $\ge$ 1).
* **Pivot High Right Length (`InpRightLenH`):** The number of succeeding bars required to confirm a standard swing high. (Must be $\ge$ 1).
* **Pivot Low Left Length (`InpLeftLenL`):** The number of preceding bars required to establish a candidate swing low valley. (Must be $\ge$ 1).
* **Pivot Low Right Length (`InpRightLenL`):** The number of succeeding bars required to confirm a standard swing low. (Must be $\ge$ 1).
* **Enable Early Trigger (`InpUseEarlyTrigger`):** Activates leading pivot recognition, confirming the swing if a close occurs past the candidate bar's body before the full right length is completed.
* **Pivot High Text Color (`InpTextColorH`):** The color applied to the price label displayed above confirmed high pivots.
* **Pivot High Label/Arrow Color (`InpLabelColorH`):** The color of the downward visual arrow marker.
* **Pivot Low Text Color (`InpTextColorL`):** The color applied to the price label displayed below confirmed low pivots.
* **Pivot Low Label/Arrow Color (`InpLabelColorL`):** The color of the upward visual arrow marker.
* **Show labels on Pivot Bar (`InpShowRetroactive`):** Draws the visual labels on the exact historical pivot candle.
* **Show labels on Confirmation Bar (`InpShowConfirmation`):** Draws non-repainting labels on the actual confirmation candle.
* **Label Font Size (`InpFontSize`):** Sets the text size for structural labels.
* **Label Font Name (`InpFontName`):** Specifies the font family used for text objects.
* **Show S&R Lines/Boxes (`InpShowSRLines`):** Toggles the projection of horizontal S&R channels or lines originating from active pivots.
* **Resistance Line Color (`InpSRColorH`):** The visual color for high pivot S&R levels.
* **Support Line Color (`InpSRColorL`):** The visual color for low pivot S&R levels.
* **Line/Box Border Width (`InpSRWidth`):** Sets the border thickness for pivot S&R objects.
* **Line Style (`InpSRStyle`):** Chooses the dash/solid drawing style for projected pivot lines.
* **Box Height in Points (`InpBoxHeightPoints`):** Defines the height of the S&R zone box. Set to 0 to draw a clean flat line instead of a box.
* **Fill S&R Box (`InpFillBox`):** Fills the drawn S&R boxes with background color if height is greater than 0.
### === 2. Leading Order Block & Breaker Settings ===
* **Swing Length Lookback (`InpZigZagLength`):** The lookback period used by the swing algorithm to detect market pivots.
* **Extend OBs into future (`InpProjectBars`):** The number of bars to project the active order block and breaker boxes to the right.
* **Require Lower Low / Higher High (`InpStrictReversal`):** Restricts setup generation to strict market structure transitions.
* **Require Imbalance (`InpRequireImbalance`):** Ensures an Order Block is only validated if accompanied by a Fair Value Gap (imbalance).
* **Require Body Close for MSB/BOS (`InpRequireBodyBreak`):** Avoids wick wicking traps by requiring a full candle body close to confirm structure breaks.
* **Avoid Overlapping OBs (`InpAvoidOverlap`):** Filters out redundant overlapping order blocks for a cleaner chart layout.
* **Order Block Selection Method (`InpObMethod`):** Selects either the *Nearest* opposite candle or the *Extreme* (highest high/lowest low) candle at the swing point.
* **Order Block Box Range (`InpObRange`):** Determines the horizontal box boundaries (Full High-to-Low candle, Open-to-Extreme wick, or Body Only).
* **Entry Level % (`InpEntryLevelPercent`):** Calculates custom entry line placements within the box (0% = Proximal edge, 50% = Mean Threshold, 100% = Distal edge).
* **Entry Line Color (`InpEntryLineColor`):** Color of the custom entry dashed line.
* **Show Risk:Reward Lines (`InpShowRR`):** Toggles visual Stop Loss and Take Profit levels.
* **Risk Reward Ratio (`InpRRRatio`):** Sets the target multiplier relative to the defined order block risk.
* **Take Profit Line Color (`InpTPLineColor`):** Style color for take-profit target lines.
* **Stop Loss Line Color (`InpSLLineColor`):** Style color for stop-loss protective lines.
* **Bullish OB Color (`InpBuOBFillColor`):** Color for active bullish order blocks.
* **Bearish OB Color (`InpBeOBFillColor`):** Color for active bearish order blocks.
* **Flipped to Support Color (`InpBuBreakerColor`):** Color applied when a bearish order block is breached and flipped to a bullish breaker.
* **Flipped to Resistance Color (`InpBeBreakerColor`):** Color applied when a bullish order block is breached and flipped to a bearish breaker.
### === 3. Supply & Demand Zones === * **Max Zones (`InpMaxZones`):** Limits the maximum number of active supply and demand zones drawn on chart to manage overhead.
* **Impulse Strength (`InpImpulseStr`):** The multiplier requirement checking the expansion velocity out of a zone relative to the size of the origin block.
* **Show 50% Line (`InpShow50Line`):** Toggles the drawing of the median equilibrium line within S&D zones.
* **Extend Zones into Future (`InpExtendBars`):** Projections width in bars into the right margin.
* **Min Zone Size (`InpMinZonePoints`):** Filters out minor noise levels by enforcing a minimum height in points for S&D zones.
* **Show "Supply/Demand" Text Labels (`InpShowLabels`):** Toggles visual text descriptions near active zones.
* **Demand Fill Color (`InpColorDemandFill`):** Color for active demand rectangle fills.
* **Supply Fill Color (`InpColorSupplyFill`):** Color for active supply rectangle fills.
* **Zone Border Color (`InpColorBorder`):** Border line style for S&D rectangles.
* **50% Line Color (`InpColor50Line`):** Visual color for the optional equilibrium line.
### === 4. Awesome S/R Levels === * **S/R Historical Lookback (`InpAOLookback`):** Sets the lookback limit in bars for scanning structural oscillator peaks (0 defaults to yesterday's open).
* **Peak Confirmation Bars (`InpAOPeakPeriod`):** Configures peak checks using either 3-bar or 5-bar confirmation boundaries.
* **Support Color (`SupportColor`):** Color used for projected horizontal support lines when price remains above the level.
* **Resistance Color (`ResistanceColor`):** Color used for projected horizontal resistance lines when price remains below the level.
* **S/R Line Width (`LineWidth`):** Adjusts thickness of the AO key levels.
* **S/R Line Style (`LineStyle`):** Visual dash/solid style for AO horizontal lines.
