OPEN-SOURCE SCRIPT
已更新 Apex Edge – HTF Overlay Candles

“Trade your 5m chart with the eyes of the 1H — Apex Edge brings higher-timeframe structure and liquidity sweeps directly onto your execution chart.”
Apex Edge – HTF Overlay Candles
The Apex Edge – HTF Overlay Candles indicator overlays higher-timeframe (HTF) candles directly onto your lower-timeframe chart. Instead of flipping between timeframes, you see HTF structure “breathe” live on your execution chart.
What It Does
• HTF Body Boxes → open/close zones drawn as semi-transparent rectangles.
• HTF Wick Boxes → high/low extremes projected as envelopes around each body.
• Midpoint Line → a dynamic equilibrium line that flips bias as price trades above or below.
• Sweep Arrows → one-time markers showing the first liquidity raid at HTF highs or lows.
Under the Hood
This isn’t just a visual overlay — it’s engineered for accuracy and performance in PineScript.
1. HTF Data Retrieval
• Uses request.security() to import open, high, low, close, time from any selected HTF.
• lookahead=barmerge.lookahead_off ensures OHLC values update bar by bar as the HTF
candle builds.
• When the HTF bar closes, boxes and midpoint lock to historical values — matching the
native HTF chart exactly.
2. Box Construction
• Body box: built from HTF open → close.
• Wick box: built from HTF high → low.
• Boxes extend dynamically across each HTF period, updating in real time, then freeze at
close.
3. Midpoint Logic
• (htfOpen + htfClose) / 2 calculates intrabar midpoint.
• Line drawn edge-to-edge across the active HTF body.
• Style, width, color, and opacity are user-controlled.
4. Sweep Detection
• Flags (sweepedHigh / sweepedLow) prevent clutter: only the first tap per side per HTF
candle is marked.
• Lower-timeframe price breaking the HTF high/low triggers the sweep arrow.
• Arrows are offset above/below wick envelopes for clean visuals.
5. Customisation
• Every layer (body, wick, midpoint, arrows) has independent color + opacity settings.
• Arrow size, arrow color, and transparency are adjustable.
• Default HTF = 1H (perfect for 5m/15m traders) but can be switched to 30m, 4H, Daily,
etc.
Why It’s Useful
• HTF intent + LTF execution without chart hopping.
• Liquidity mapping: see where liquidity is swept in real time.
• Bias clarity: midpoint line defines HTF equilibrium.
• Clean signals: only the first sweep prints — no spam.
What Makes It Different
Most MTF overlays just plot candles or single lines. This tool:
• Splits body vs wick zones for institutional precision.
• Updates live intrabar (no repainting).
• Highlights liquidity sweeps clearly.
• Built for readability and professional use — not another retail signal toy.
Cheat-Sheet Playbook
1️⃣ Structure Bias
• Above midpoint line = bullish intent.
• Below midpoint line = bearish intent.
• Chop around midpoint = no clear direction.
2️⃣ Liquidity Sweeps
• ▲ Green up arrow below wick box = sell-side liquidity taken → watch for longs.
• ▼ Red down arrow above wick box = buy-side liquidity taken → watch for shorts.
• First sweep is the cleanest.
3️⃣ Trade Logic
• Body box = where institutions transact.
• Wick box = liquidity traps.
• Midpoint = bias filter.
• Best setups occur when sweep + midpoint flip align.
4️⃣ Example (5m + 1H Overlay)
1. ▲ Green up arrow prints below HTF wick.
2. Price reclaims the body box.
3. Midpoint flips to support.
4. Enter long → stop below sweep → targets = midpoint first, opposite wick second.
In short:
• Boxes = structure
• Wicks = liquidity pools
• Midpoint = bias line
• Arrows = liquidity sweeps
This is your SMC edge on one chart — HTF structure and liquidity fused directly into your execution timeframe.
Apex Edge – HTF Overlay Candles
The Apex Edge – HTF Overlay Candles indicator overlays higher-timeframe (HTF) candles directly onto your lower-timeframe chart. Instead of flipping between timeframes, you see HTF structure “breathe” live on your execution chart.
What It Does
• HTF Body Boxes → open/close zones drawn as semi-transparent rectangles.
• HTF Wick Boxes → high/low extremes projected as envelopes around each body.
• Midpoint Line → a dynamic equilibrium line that flips bias as price trades above or below.
• Sweep Arrows → one-time markers showing the first liquidity raid at HTF highs or lows.
Under the Hood
This isn’t just a visual overlay — it’s engineered for accuracy and performance in PineScript.
1. HTF Data Retrieval
• Uses request.security() to import open, high, low, close, time from any selected HTF.
• lookahead=barmerge.lookahead_off ensures OHLC values update bar by bar as the HTF
candle builds.
• When the HTF bar closes, boxes and midpoint lock to historical values — matching the
native HTF chart exactly.
2. Box Construction
• Body box: built from HTF open → close.
• Wick box: built from HTF high → low.
• Boxes extend dynamically across each HTF period, updating in real time, then freeze at
close.
3. Midpoint Logic
• (htfOpen + htfClose) / 2 calculates intrabar midpoint.
• Line drawn edge-to-edge across the active HTF body.
• Style, width, color, and opacity are user-controlled.
4. Sweep Detection
• Flags (sweepedHigh / sweepedLow) prevent clutter: only the first tap per side per HTF
candle is marked.
• Lower-timeframe price breaking the HTF high/low triggers the sweep arrow.
• Arrows are offset above/below wick envelopes for clean visuals.
5. Customisation
• Every layer (body, wick, midpoint, arrows) has independent color + opacity settings.
• Arrow size, arrow color, and transparency are adjustable.
• Default HTF = 1H (perfect for 5m/15m traders) but can be switched to 30m, 4H, Daily,
etc.
Why It’s Useful
• HTF intent + LTF execution without chart hopping.
• Liquidity mapping: see where liquidity is swept in real time.
• Bias clarity: midpoint line defines HTF equilibrium.
• Clean signals: only the first sweep prints — no spam.
What Makes It Different
Most MTF overlays just plot candles or single lines. This tool:
• Splits body vs wick zones for institutional precision.
• Updates live intrabar (no repainting).
• Highlights liquidity sweeps clearly.
• Built for readability and professional use — not another retail signal toy.
Cheat-Sheet Playbook
1️⃣ Structure Bias
• Above midpoint line = bullish intent.
• Below midpoint line = bearish intent.
• Chop around midpoint = no clear direction.
2️⃣ Liquidity Sweeps
• ▲ Green up arrow below wick box = sell-side liquidity taken → watch for longs.
• ▼ Red down arrow above wick box = buy-side liquidity taken → watch for shorts.
• First sweep is the cleanest.
3️⃣ Trade Logic
• Body box = where institutions transact.
• Wick box = liquidity traps.
• Midpoint = bias filter.
• Best setups occur when sweep + midpoint flip align.
4️⃣ Example (5m + 1H Overlay)
1. ▲ Green up arrow prints below HTF wick.
2. Price reclaims the body box.
3. Midpoint flips to support.
4. Enter long → stop below sweep → targets = midpoint first, opposite wick second.
In short:
• Boxes = structure
• Wicks = liquidity pools
• Midpoint = bias line
• Arrows = liquidity sweeps
This is your SMC edge on one chart — HTF structure and liquidity fused directly into your execution timeframe.
版本注释
MAJOR FIXES:• Fixed HTF overlay timing alignment - boxes now perfectly match LTF price action
• Corrected sweep detection synchronization with new HTF timing
• Eliminated 1-period right offset that caused misalignment
NEW FEATURES:
• Added comprehensive alert system for HTF liquidity sweeps
• Three alert types: High sweep, Low sweep, and General sweep alerts
• Real-time notifications when HTF levels are breached
IMPROVEMENTS:
• HTF boxes now span exact time periods using boundary tracking
• Sweep arrows appear on first LTF candle that breaches HTF levels
• Enhanced accuracy for multi-timeframe analysis
• Optimized performance with proper variable management
TECHNICAL CHANGES:
• Implemented HTF period boundary tracking system
• Replaced offset calculations with actual time boundary detection
• Added proper sweep flag management per HTF period
• Integrated alertcondition() functions for notifications
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。