OPEN-SOURCE SCRIPT
Atualizado 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.
Notas de Lançamento
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
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.
Script de código aberto
No verdadeiro espirito do TradingView, o autor desse script o publicou como código aberto, para que os traders possam entendê-lo e verificá-lo. Parabéns ao autor Você pode usá-lo gratuitamente, mas a reutilização desse código em publicações e regida pelas Regras da Casa.
Aviso legal
As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.