OPEN-SOURCE SCRIPT
HTF SMC Confluence[KG]

HTF SMC Confluence is basically lazy trader's best friend — because who has time to actually switch timeframes like some kind of animal?
It slaps a big higher timeframe candle right onto your chart, throws in Fair Value Gaps, Market Structure Shifts, and Displacement Zones, and whispers "institutional money was HERE" so you don't have to go hunting for it yourself.
It was built around one gloriously obvious idea: that trading a 5-minute chart while completely ignoring the daily is like navigating a highway by only looking at your hood ornament. This tool finally makes you look up — without making you do any extra work. Confluence, served hot, on a single canvas. You're welcome.
─────────────────────────────────────────────────────────────
WHAT EACH COMPONENT DOES
─────────────────────────────────────────────────────────────
1. HTF CANDLE (plotted to the right of price)
A full OHLC candle from a higher timeframe is rendered live to the right of
your current price action. It updates tick by tick — the body, wick, and
color all reflects the evolving HTF candle in real time. Up to 5 historical
HTF candles can be displayed side by side for recent context. The wick is
precisely centered on the candle body, and the candle repositions itself
automatically on every bar so it always floats cleanly beyond the rightmost
price bar.
What it tells you: the current mood of the higher timeframe. A bullish daily
candle forming while the 5m sells off is a very different scenario than a
bearish daily candle in distribution.
2. HIGH / LOW LINES
Solid horizontal lines are drawn from the HTF candle's high and low, running
across the chart and labeled "High" and "Low." These mark the range that
institutional players defined on the higher timeframe. Price tends to respect
these levels — they act as magnets, decision zones, and areas of liquidity.
3. MIDLINE (dotted)
A dotted line sits exactly halfway between the HTF High and Low — the
equilibrium of the HTF range. In SMC theory, this is called the "50% level"
or "CE" (Consequent Encroachment). Price retracing to this level inside a
bullish candle is often an optimal entry zone. It is subtle by design —
informational, not dominant.
4. FAIR VALUE GAP (FVG)
A Fair Value Gap is a three-candle imbalance pattern. When a candle moves so
aggressively in one direction that it leaves a gap between the first and
third candle's wicks — price skipped over that zone. Institutions tend to
return to these gaps to "fill" the imbalance before continuing the move.
Bearish FVGs are highlighted in red, bullish in green. A label mark each
box. Up to a user-defined maximum number of FVGs are tracked and old ones
are automatically removed.
5. MARKET STRUCTURE SHIFT (MSS)
An MSS occurs the moment price decisively closes beyond a prior swing point,
signaling a change in directional intent. A bearish MSS is when price
closes below a recent swing low — the market is no longer making higher
lows. A bullish MSS is when price closes above a recent swing high. A
horizontal line is drawn at the broken level and labeled "MSS." Up to 5
recent MSS events are displayed; older ones clean up automatically.
6. DISPLACEMENT ZONE
Displacement is a series of consecutive strong candles in one direction
where the average body size exceeds a multiple of the ATR. It represents
institutional aggression — the moment "smart money" stepped in hard and
drove price. These zones are shaded on the chart and serve as reference
for where the real move originated, helping traders distinguish displacement
from manipulation.
─────────────────────────────────────────────────────────────
RECOMMENDED TIMEFRAME COMBINATIONS
─────────────────────────────────────────────────────────────
The indicator is designed around a top-down multi-timeframe workflow. The HTF
candle shown on the right should always be at least 4-6x the current chart's
timeframe. Below are the most practical pairings:
CHART TIMEFRAME / HTF CANDLE SETTING/ USE CASE
──────────────────────────────────────────────────────
1 minute................... 15 minute ...............Scalping with intraday structure
3 minute ............................30 minute .................Scalping with session context
5 minute ............................1 hour .....................Intraday momentum trades
5 minute ........................... 4 hour .................... Intraday with swing context
15 minute ..........................4 hour .................... Intraday swing setups
15 minute ..........................Daily (1D) ................ Most common: intraday vs daily
1 hour ..............................Daily (1D) .................Swing trades
1 hour ..............................Weekly (1W) ..............Position trade entries
4 hour ..............................Weekly (1W) ..............Swing / position trading
─────────────────────────────────────────────────────────────
HOW TO TRADE WITH THIS INDICATOR
─────────────────────────────────────────────────────────────
The indicator does not generate buy or sell signals. Instead, it provides a
structured framework for identifying high-probability setups using confluence.
The following is a general workflow:
STEP 1 — READ THE HTF CANDLE
Before anything else, look at the HTF candle on the right. Is it bullish or
bearish? Is it nearing its high or low? This tells you about the directional bias for
the session. Only take trades in the direction of the HTF candle unless you
have strong evidence of a reversal.
STEP 2 — IDENTIFY THE RANGE
The High and Low lines define the playing field. Price at or near the HTF
High is at resistance — look for bearish setups. Price at or near the HTF
Low is at support — look for bullish setups. The midline is a secondary
decision zone — often acts as a magnet when price is between the levels.
STEP 3 — WAIT FOR STRUCTURE (MSS)
An MSS on the lower timeframe in the direction of your HTF bias is one of
the strongest confirmation signals. For example: if the daily candle is
bullish, wait for a bullish MSS on the 5-minute chart — a close above a
swing high — before entering long. This tells you short-term structure has
flipped in your favour.
STEP 4 — LOOK FOR AN FVG ENTRY
After an MSS, price often retraces into a Fair Value Gap before continuing.
This gap is your precision entry zone. Enter at the edge of the FVG closest
to current price. Place your stop loss below the FVG (for longs) or above
it (for shorts). The FVG acts as your entry trigger and risk anchor.
STEP 5 — CONFIRM WITH DISPLACEMENT
If the MSS was preceded by a Displacement Zone — meaning price moved
aggressively to create the structure break — the setup is higher quality.
Displacement followed by a retracement into an FVG, with an MSS confirming,
is the textbook SMC entry pattern this indicator is designed to highlight.
STEP 6 — SET TARGETS
Common targets are the HTF High (if long) or HTF Low (if short). The
midline is a partial-take-profit level. Always assess the risk-to-reward
before entry — aim for a minimum of 1:2.
─────────────────────────────────────────────────────────────
WHAT THIS INDICATOR DOES NOT DO
─────────────────────────────────────────────────────────────
— It does not generate buy or sell signals
— It does not repaint historical data (all drawings are forward-only)
— It does not account for news events, earnings, or macro catalysts
— It does not guarantee any outcome
— It is not a standalone trading system
─────────────────────────────────────────────────────────────
DISCLAIMER
─────────────────────────────────────────────────────────────
This indicator and the accompanying documentation are provided strictly for
educational and informational purposes only. Nothing contained herein
constitutes financial advice, investment advice, trading advice, or any other
form of professional financial guidance. Past performance of any trading system, strategy, or indicator — including the concepts demonstrated here — is not indicative of future results. Use this tool as one input among many — never as the sole basis for a trade.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF SMC Confluence — Built for traders who think in timeframes, not ticks. Happy Trading!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
It slaps a big higher timeframe candle right onto your chart, throws in Fair Value Gaps, Market Structure Shifts, and Displacement Zones, and whispers "institutional money was HERE" so you don't have to go hunting for it yourself.
It was built around one gloriously obvious idea: that trading a 5-minute chart while completely ignoring the daily is like navigating a highway by only looking at your hood ornament. This tool finally makes you look up — without making you do any extra work. Confluence, served hot, on a single canvas. You're welcome.
─────────────────────────────────────────────────────────────
WHAT EACH COMPONENT DOES
─────────────────────────────────────────────────────────────
1. HTF CANDLE (plotted to the right of price)
A full OHLC candle from a higher timeframe is rendered live to the right of
your current price action. It updates tick by tick — the body, wick, and
color all reflects the evolving HTF candle in real time. Up to 5 historical
HTF candles can be displayed side by side for recent context. The wick is
precisely centered on the candle body, and the candle repositions itself
automatically on every bar so it always floats cleanly beyond the rightmost
price bar.
What it tells you: the current mood of the higher timeframe. A bullish daily
candle forming while the 5m sells off is a very different scenario than a
bearish daily candle in distribution.
2. HIGH / LOW LINES
Solid horizontal lines are drawn from the HTF candle's high and low, running
across the chart and labeled "High" and "Low." These mark the range that
institutional players defined on the higher timeframe. Price tends to respect
these levels — they act as magnets, decision zones, and areas of liquidity.
3. MIDLINE (dotted)
A dotted line sits exactly halfway between the HTF High and Low — the
equilibrium of the HTF range. In SMC theory, this is called the "50% level"
or "CE" (Consequent Encroachment). Price retracing to this level inside a
bullish candle is often an optimal entry zone. It is subtle by design —
informational, not dominant.
4. FAIR VALUE GAP (FVG)
A Fair Value Gap is a three-candle imbalance pattern. When a candle moves so
aggressively in one direction that it leaves a gap between the first and
third candle's wicks — price skipped over that zone. Institutions tend to
return to these gaps to "fill" the imbalance before continuing the move.
Bearish FVGs are highlighted in red, bullish in green. A label mark each
box. Up to a user-defined maximum number of FVGs are tracked and old ones
are automatically removed.
5. MARKET STRUCTURE SHIFT (MSS)
An MSS occurs the moment price decisively closes beyond a prior swing point,
signaling a change in directional intent. A bearish MSS is when price
closes below a recent swing low — the market is no longer making higher
lows. A bullish MSS is when price closes above a recent swing high. A
horizontal line is drawn at the broken level and labeled "MSS." Up to 5
recent MSS events are displayed; older ones clean up automatically.
6. DISPLACEMENT ZONE
Displacement is a series of consecutive strong candles in one direction
where the average body size exceeds a multiple of the ATR. It represents
institutional aggression — the moment "smart money" stepped in hard and
drove price. These zones are shaded on the chart and serve as reference
for where the real move originated, helping traders distinguish displacement
from manipulation.
─────────────────────────────────────────────────────────────
RECOMMENDED TIMEFRAME COMBINATIONS
─────────────────────────────────────────────────────────────
The indicator is designed around a top-down multi-timeframe workflow. The HTF
candle shown on the right should always be at least 4-6x the current chart's
timeframe. Below are the most practical pairings:
CHART TIMEFRAME / HTF CANDLE SETTING/ USE CASE
──────────────────────────────────────────────────────
1 minute................... 15 minute ...............Scalping with intraday structure
3 minute ............................30 minute .................Scalping with session context
5 minute ............................1 hour .....................Intraday momentum trades
5 minute ........................... 4 hour .................... Intraday with swing context
15 minute ..........................4 hour .................... Intraday swing setups
15 minute ..........................Daily (1D) ................ Most common: intraday vs daily
1 hour ..............................Daily (1D) .................Swing trades
1 hour ..............................Weekly (1W) ..............Position trade entries
4 hour ..............................Weekly (1W) ..............Swing / position trading
─────────────────────────────────────────────────────────────
HOW TO TRADE WITH THIS INDICATOR
─────────────────────────────────────────────────────────────
The indicator does not generate buy or sell signals. Instead, it provides a
structured framework for identifying high-probability setups using confluence.
The following is a general workflow:
STEP 1 — READ THE HTF CANDLE
Before anything else, look at the HTF candle on the right. Is it bullish or
bearish? Is it nearing its high or low? This tells you about the directional bias for
the session. Only take trades in the direction of the HTF candle unless you
have strong evidence of a reversal.
STEP 2 — IDENTIFY THE RANGE
The High and Low lines define the playing field. Price at or near the HTF
High is at resistance — look for bearish setups. Price at or near the HTF
Low is at support — look for bullish setups. The midline is a secondary
decision zone — often acts as a magnet when price is between the levels.
STEP 3 — WAIT FOR STRUCTURE (MSS)
An MSS on the lower timeframe in the direction of your HTF bias is one of
the strongest confirmation signals. For example: if the daily candle is
bullish, wait for a bullish MSS on the 5-minute chart — a close above a
swing high — before entering long. This tells you short-term structure has
flipped in your favour.
STEP 4 — LOOK FOR AN FVG ENTRY
After an MSS, price often retraces into a Fair Value Gap before continuing.
This gap is your precision entry zone. Enter at the edge of the FVG closest
to current price. Place your stop loss below the FVG (for longs) or above
it (for shorts). The FVG acts as your entry trigger and risk anchor.
STEP 5 — CONFIRM WITH DISPLACEMENT
If the MSS was preceded by a Displacement Zone — meaning price moved
aggressively to create the structure break — the setup is higher quality.
Displacement followed by a retracement into an FVG, with an MSS confirming,
is the textbook SMC entry pattern this indicator is designed to highlight.
STEP 6 — SET TARGETS
Common targets are the HTF High (if long) or HTF Low (if short). The
midline is a partial-take-profit level. Always assess the risk-to-reward
before entry — aim for a minimum of 1:2.
─────────────────────────────────────────────────────────────
WHAT THIS INDICATOR DOES NOT DO
─────────────────────────────────────────────────────────────
— It does not generate buy or sell signals
— It does not repaint historical data (all drawings are forward-only)
— It does not account for news events, earnings, or macro catalysts
— It does not guarantee any outcome
— It is not a standalone trading system
─────────────────────────────────────────────────────────────
DISCLAIMER
─────────────────────────────────────────────────────────────
This indicator and the accompanying documentation are provided strictly for
educational and informational purposes only. Nothing contained herein
constitutes financial advice, investment advice, trading advice, or any other
form of professional financial guidance. Past performance of any trading system, strategy, or indicator — including the concepts demonstrated here — is not indicative of future results. Use this tool as one input among many — never as the sole basis for a trade.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HTF SMC Confluence — Built for traders who think in timeframes, not ticks. Happy Trading!
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.
نص برمجي مفتوح المصدر
بروح TradingView الحقيقية، قام مبتكر هذا النص البرمجي بجعله مفتوح المصدر، بحيث يمكن للمتداولين مراجعة وظائفه والتحقق منها. شكرا للمؤلف! بينما يمكنك استخدامه مجانًا، تذكر أن إعادة نشر الكود يخضع لقواعد الموقع الخاصة بنا.
إخلاء المسؤولية
لا يُقصد بالمعلومات والمنشورات أن تكون، أو تشكل، أي نصيحة مالية أو استثمارية أو تجارية أو أنواع أخرى من النصائح أو التوصيات المقدمة أو المعتمدة من TradingView. اقرأ المزيد في شروط الاستخدام.