PROTECTED SOURCE SCRIPT

HTF High/Low Mitigation with Signals [BETA]

615
📈 HTF/CTF High–Low Mitigation with Signals (H/L Signals+)
Overview
HTF/CTF High–Low Mitigation with Signals is an advanced multi-timeframe tool designed for Smart Money Concepts (SMC) and institutional order-flow traders.
It automatically tracks Higher-Timeframe (HTF) highs/lows and Current-Timeframe (CTF) swing points, detects mitigations, and generates trade signals with visualized risk-reward boxes and built-in backtesting statistics.
This script bridges higher-timeframe liquidity structures with lower-timeframe confirmations — helping traders identify true mitigation entries, validate directional bias, and manage risk precisely.

🔍 Core Concept
HTF highs/lows represent key liquidity zones or unmitigated order blocks.


Mitigation occurs when price closes beyond (or wicks through, depending on settings) those levels, confirming liquidity has been absorbed.


When mitigation aligns with EMA structure confirmation, the indicator generates Buy or Sell signals.


The CTF swing system highlights intraday micro-liquidity points for fine-tuned entries and exits.



⚙️ Key Functional Blocks
1. HTF Detection
Defines a Higher Timeframe (default: Daily) and tracks its highs/lows bar-by-bar.


Automatically draws persistent horizontal lines for each unmitigated level.


On new HTF candle open:


Previous session’s high/low levels are locked and plotted.


These levels remain active until they are mitigated (touched or closed through).


2. Mitigation Logic
Wick-based or Close-based detection:


Wick mitigation: triggered by wick touch (useful for liquidity sweeps).


Close mitigation: requires candle body confirmation.


Upon mitigation:


HTF line color/style changes to “mitigated” form.


Optional alert notifies the trader instantly.


A corresponding trade setup flag (buy or sell) is armed.


3. CTF Swing Structure
Detects micro swing highs/lows based on the selected swing candle count.


Each swing is drawn as a CTF line with separate color and style.


Tracks mitigation of these smaller levels separately, helping identify nested liquidity sweeps or LTF retests.


4. EMA Trend Confirmation
Utilizes a 3-layer EMA ribbon (8/13/21 default):


Confirms bullish/bearish alignment (stacked order).


Color-coded ribbon visualization for directional clarity.


A Buy Signal occurs when:


An HTF low is mitigated, and


EMAs align bullish (8 > 13 > 21), with price above the slow EMA.


A Sell Signal occurs when:


An HTF high is mitigated, and


EMAs align bearish (8 < 13 < 21), with price below the slow EMA.


5. Automatic Trade Simulation
When a valid signal appears:
The system simulates a trade:


Entry = current close


Stop = most recent swing high/low before mitigation


Take Profit = multiple of risk (selectable 1–5R)


Calculates position size automatically based on user-defined risk ($).


Draws Risk/Reward (R/R) Boxes on chart with trade stats.


Monitors trade outcome (TP or SL hit) and automatically tracks performance metrics.


6. Built-in Backtester & Statistics Table
Tracks over time:
✅ Total trades, Wins, Losses


📊 Win rate (%), Net R return


⚠️ Maximum consecutive losses
Displays live performance summary in a compact table (top-right corner).



🎨 Visual Elements
Visual Component
Purpose
Red / Teal HTF lines
Active HTF highs/lows awaiting mitigation
Gray dotted HTF lines
Mitigated HTF levels
Purple / Aqua CTF lines
LTF swing highs/lows (microstructure)
Colored R/R boxes
Trade zones (risk = gray, reward = green/orange)
EMA Ribbon
Trend bias visualization (green for bullish, red for bearish)
BUY/SELL markers
Trade entry points
Stats Table
Real-time performance summary


⚡ Alerts
HTF Mitigation Alerts: instantly notifies when a higher timeframe level is mitigated.
Format example:

D1 High Mitigated at 2050.50


Buy/Sell Trade Alerts: triggered upon trade signal confirmation with full details (entry, stop, TP, position size).



📏 Risk Management Integration
The indicator computes position size automatically:
Based on risk in $ and distance between entry and stop.


Supports Forex, Gold, Silver, and Futures by adapting tick values per symbol.


The position size readout is embedded in each R/R box.



🧠 Smart Cleanup Logic
Automatically limits total drawn lines to prevent chart clutter.


Older lines (mitigated or excessive) are deleted once limits are reached:


HTF highs/lows


CTF swings (mitigated & unmitigated)



⚙️ Customization
Everything is fully adjustable:
HTF timeframe, wick vs close mitigation logic, line colors/styles


CTF swing detection precision


EMA ribbon visibility and periods


Risk/Reward parameters and box visuals


Alert toggles


Max number of tracked highs/lows per timeframe



📊 Use Cases
Identify high-probability mitigation entries after HTF liquidity sweeps.


Use EMA structure for directional bias confirmation.


Combine with volume or order-flow indicators for confluence.


Backtest your rules visually with real-time stats and R-multiple tracking.


Integrate alerts for automated notification systems (e.g. Telegram bots, webhooks).



🧩 Compatibility & Notes
Works across any symbol or market (FX, commodities, indices, crypto).


Supports both intraday scalping and swing trading workflows.


All signals are non-repainting; confirmations occur at candle close.


Script optimized for performance and memory cleanup with efficient array management.

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.