ICT MMM/AMD (Power of 3) [UAlgo]ICT MMM / AMD (Power of 3) is an intraday market structure framework that models the classic Accumulation, Manipulation, Distribution cycle using configurable killzones. The script tracks the Asia range as the accumulation anchor, looks for a liquidity sweep during the London window, waits for a Market Structure Shift confirmation, and then maps a clean entry model using Fair Value Gap logic and optional displacement requirements.
Beyond the core cycle, the indicator provides two additional layers of context:
Previous Day High and Previous Day Low levels for higher timeframe objectives
A dynamic Dealing Range built from recent pivots to visualize premium, discount, and equilibrium
The result is a structured workflow tool that organizes ICT style intraday logic into clear, step by step states with optional filters for cleaner execution.
🔹 Features
1) Session Based Cycle Engine (Killzones)
The script is built around three sessions selected by the user and evaluated in a chosen IANA timezone:
Accumulation window, typically Asia
Manipulation window, typically London
Distribution window, typically New York AM
Each day begins a new cycle at the start of the accumulation session. The script tracks the running high and low during accumulation, then finalizes those boundaries at the end of the session to create the reference range used by later steps.
2) Accumulation Range Mapping
During accumulation, the indicator maintains:
Accumulation High
Accumulation Low
Optional border only box around the session range
Optional ACC label
When the accumulation window ends, the high and low are frozen and drawn as clean horizontal guides using your selected line style and width.
3) Liquidity Sweep Detection With ATR and Tick Filters
During the manipulation window, the indicator checks for a sweep beyond the accumulation boundaries. The sweep threshold is adaptive and uses the larger of:
A minimum tick distance
A minimum ATR based distance
You can also choose whether sweep validation uses wicks or closes:
Wicks uses High and Low
Closes uses Close only
When a sweep is confirmed, the script labels it as BSL sweep if it sweeps above highs, or SSL sweep if it sweeps below lows. Optional sweep level and wick markers can also be drawn for precise reference.
4) Market Structure Shift Confirmation
After a sweep, the script waits for a Market Structure Shift using confirmed pivots. Pivot Length controls strictness. Higher values require cleaner structure and reduce false shifts, at the cost of added confirmation delay.
Bullish MSS is confirmed when price closes above the most recent confirmed pivot high after an SSL sweep
Bearish MSS is confirmed when price closes below the most recent confirmed pivot low after a BSL sweep
Optional MSS break lines can be displayed so you can see the exact level that defined the shift.
5) Displacement Qualification (Optional Gate Before FVG)
Displacement can be required before Fair Value Gap detection. This filter attempts to enforce a strong impulse candle after MSS by checking:
Body to range proportion
Body size relative to ATR
Directional strength by requiring a break beyond the prior candle extreme
This helps separate soft rotations from decisive expansions, which tends to improve FVG quality in many market conditions.
6) Fair Value Gap Detection and Management
After MSS, the script scans a configurable number of bars for a valid FVG.
Bullish FVG condition uses a three candle gap where the current low is above the high two bars ago
Bearish FVG condition uses a three candle gap where the current high is below the low two bars ago
Once an FVG is active, the script draws top and bottom boundary lines and optionally labels it. When price returns into the gap, the script treats it as mitigated. If the remove option is enabled, the FVG drawings are deleted after mitigation to keep the chart clean.
7) Entry Marking With Optional Distribution Filter
When price touches the active FVG, the script can print an ENTRY label and place a stop line.
Entry can be restricted to the distribution window if desired
This can reduce off session prints and align entries with the intended time of day logic
The stop level is anchored to the sweep extreme with an optional tick padding so you can adapt to spread and micro structure noise.
8) Target Framework Per Cycle
Targets are evaluated after MSS using your selected Target Mode:
PDH PDL only
Range only
PDH PDL plus Range
For bullish MSS, targets can include PDH and the accumulation high
For bearish MSS, targets can include PDL and the accumulation low
Target lines update forward and can stop extending once price hits them, keeping the cycle output visually informative without turning into permanent clutter.
9) Dealing Range Premium Discount Map
A Dealing Range is built from the most recent confirmed pivot high and pivot low using a separate pivot length setting. The script then computes:
Premium as the upper boundary
Discount as the lower boundary
Equilibrium as the midpoint
Optional labels mark DR PREMIUM, DR DISCOUNT, and DR EQ (50%) so you can quickly align entries with premium and discount logic.
10) Previous Day High and Low Overlay
PDH and PDL are pulled from the daily timeframe and drawn as global reference levels. These update at each new day and can be displayed with labels. This keeps higher timeframe objectives visible even when trading lower timeframes.
11) Visual Control and Cycle Retention
The indicator offers full control over:
Line styles
Line widths
Whether lines extend into the future
Whether to show boxes, labels, sweep lines, MSS lines, targets, and dealing range
Completed cycles are stored and older cycles are pruned based on Keep Last Cycles. This preserves recent context while keeping object counts under control.
🔹 Calculations
1) Session State Logic
Each session is evaluated using the chart timeframe, the session input, and the selected timezone. A cycle starts when the accumulation session turns on and ends when it turns off.
Conceptually:
inAcc is true when the current bar time falls inside the accumulation session
accStart is the transition from not inAcc to inAcc
accEnd is the transition from inAcc to not inAcc
These transitions control the lifecycle of each MMM cycle object.
2) Accumulation Range Construction
During accumulation, the script continuously updates the running high and low:
accHigh becomes the maximum observed high within the session
accLow becomes the minimum observed low within the session
At accEnd, these values are finalized and turned into horizontal range guides that define the boundaries used for sweep validation and optional range targets.
3) Sweep Threshold Model
Sweep threshold is a conservative maximum of two measurements:
Minimum sweep distance in ticks
Minimum sweep distance as a fraction of ATR
This creates a single threshold thr that adapts to volatility while still respecting a hard minimum in ticks.
Sweep evaluation then compares either:
High and Low if wicks are used
Close if closes are used
A sweep is confirmed when price probes beyond accHigh plus thr or beyond accLow minus thr.
4) MSS Pivot Framework
Confirmed pivots are used for structure shift validation. The script stores the most recent confirmed pivot high and pivot low and their bar indexes.
After a BSL sweep, bearish MSS triggers when close breaks below the last pivot low
After an SSL sweep, bullish MSS triggers when close breaks above the last pivot high
This ensures MSS is a structural confirmation rather than a subjective interpretation.
5) Displacement Filter Metrics
Displacement quality is checked using:
Body size relative to total candle range
Body size relative to ATR
Directional break beyond the previous candle extreme
Only when these requirements pass does the cycle allow the displacement flag, which can be used as a gate for FVG detection when enabled.
6) FVG Definition
The script uses a strict three candle gap model:
Bullish FVG when current low is above the high two bars ago
Bearish FVG when current high is below the low two bars ago
FVG is only searched within a fixed number of bars after MSS, which keeps the model aligned with the intended timing of the intraday cycle.
7) Mitigation and Entry Touch Logic
When an active FVG is present, a touch is defined as price overlapping the gap region. On the first touch:
If entry marking is enabled and the time filter allows it, the script prints ENTRY and places SL
FVG is marked as mitigated and can optionally be removed from the chart
Stop is computed from the sweep wick extreme plus optional tick padding, aligned with the idea that the sweep should remain the invalidation anchor.
8) Target Selection Logic
Targets are chosen based on direction and the Target Mode:
For bullish MSS, PDH can be Target A, accumulation high can be Target B
For bearish MSS, PDL can be Target A, accumulation low can be Target B
Targets are updated forward each bar and can stop extending once hit, which keeps the current cycle readable.
9) Dealing Range Computation
The dealing range uses the latest confirmed pivot high and pivot low:
DR high equals the higher of the two pivot prices
DR low equals the lower of the two pivot prices
DR equilibrium equals the midpoint of DR high and DR low
This provides a clean premium and discount map that updates as new pivots confirm.
10) Previous Day High and Low Retrieval
PDH and PDL are sourced from the daily timeframe using a security call that references the prior day values. They are reset at each new day, ensuring the lines represent the most recent completed daily range.
Pine Script®指标






















