OPEN-SOURCE SCRIPT
Smart Money Trend Engine

WHAT IT DOES
Smart Money Trend Engine (SMTE) is a fully original all-in-one indicator
built in Pine Script v6 that combines institutional Smart Money Concepts
with a dynamic trend coloring system. Instead of using separate indicators
for trend direction and market structure, SMTE displays everything on a
single clean overlay: bar colors change based on confirmed structural
breaks, the background reflects the active trend phase, and Smart Money
elements (BOS, CHoCH, Order Blocks, FVG, Liquidity Sweeps) are layered
on top in a way that is readable and not cluttered.
The result is a chart that tells a complete institutional story at a
glance where the trend is, where it changed, where institutions were
active, and where the next likely reaction zones are.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
WHAT MAKES IT ORIGINAL
Most trend-coloring indicators use moving average crossovers to determine
bar color. SMTE uses a fundamentally different approach: bar color is
driven by confirmed Smart Money structure breaks (BOS), not by price
position relative to a moving average. This means the color change is
tied to institutional order flow logic, not to a lagging indicator.
Three original components separate SMTE from existing public scripts:
1. Structure-driven bar coloring
Bars turn green when a bullish Break of Structure (BOS) is confirmed.
Bars turn red when a bearish BOS is confirmed. The color persists
until the next structural event, making the trend state visually
stable and easy to read even across long periods. Unlike EMA-based
coloring, the color does not flicker on every candle.
2. Intelligent CHoCH detection
A Change of Character (CHoCH) is only marked when the market
genuinely reverses after a confirmed trend — not on every first BOS
after a pullback. The indicator tracks consecutive BOS counts in each
direction and only triggers CHoCH after a real directional shift.
The CHoCH candle is colored orange to stand out from the green/red
trend bars, giving traders an immediate visual warning of a potential
trend change without constant false signals.
3. BOS streak counter
The dashboard tracks how many consecutive bullish or bearish BOS
events have occurred. Two or more BOS in the same direction confirms
a genuine trend. One BOS alone is treated as a potential structure
break but not yet confirmed. This filter significantly reduces the
number of false trend signals.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
THE FOUR VISUAL LAYERS
Layer 1 Bar and Background Color
Green bars and green background: confirmed bullish BOS. Institutions
are breaking upward structure. Price is in a bullish trend phase.
Red bars and red background: confirmed bearish BOS. Institutional
selling pressure is dominant and structure is breaking downward.
Orange bars (single candle only): CHoCH detected. This is the exact
candle where the market changed character. High alert moment.
Layer 2 Smart Money Structure
BOS lines (blue dashed for bullish, red dashed for bearish) connect
the structural pivot to the current bar, showing exactly where the
break occurred. CHoCH labels appear in orange and only when the trend
genuinely reverses. Labels are kept small and positioned away from
price to avoid visual clutter.
Layer 3 — Order Blocks and FVG
Bullish Order Blocks (green boxes) mark demand zones where institutions
previously accumulated long positions. Bearish Order Blocks (red boxes)
mark supply zones. Box height is ATR-based for precision. Fair Value
Gaps (FVG) are shown as thin shaded areas between candles where price
left an imbalance — these often act as magnet zones for future price
retracement.
Layer 4 — Liquidity Sweeps
Blue water drop labels appear when price wicks below a recent low and
closes back above (bullish sweep). Red drops appear when price wicks
above a recent high and closes back below (bearish sweep). These mark
moments where stop-losses were hunted before a potential reversal.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
HOW TO USE
Step 1 — Read the bar color
Green bars mean the last confirmed structural event was a bullish BOS.
Red bars mean the last confirmed structural event was a bearish BOS.
Stay with the color. Trade in the direction of the dominant color and
avoid counter-trend positions unless a CHoCH appears.
Step 2 Watch for CHoCH
A single orange candle means CHoCH. This is the earliest warning that
the trend may be changing. Do not immediately reverse — wait for
confirmation from the next BOS in the new direction. CHoCH alone is
a warning, not a signal.
Step 3 — Count BOS streaks
Check the Dashboard for Bull BOS and Bear BOS counters. Two or more
BOS in a row in the same direction confirms a genuine trend. One BOS
is fragile and easily reversed. Trade with higher conviction when the
streak counter shows 2 or more.
Step 4 — Use Order Blocks for entries
When price returns to a green Order Block in a bullish trend (green
bars), that is a high-probability demand zone. When price returns to
a red Order Block in a bearish trend (red bars), that is a supply zone.
Use these for precise entry planning rather than chasing breakouts.
Step 5 — Combine with FVG and Sweeps
A liquidity sweep followed by a CHoCH followed by a new BOS in the
opposite direction is the highest quality reversal setup this indicator
can show. All three elements aligning is rare and significant.
FVG zones often act as the first target after a sweep and CHoCH.
Step 6 — Read the Dashboard
SMC Bias shows the current structural direction. Last Event shows the
most recent structural event. Bull BOS and Bear BOS counters show
streak strength. Liq Sweep and FVG show real-time status of the
current bar.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
CALCULATION LOGIC
BOS detection:
Pivot high confirmed = ta.pivothigh(high, ms_len, ms_len)
Pivot low confirmed = ta.pivotlow(low, ms_len, ms_len)
Bull BOS = new pivot high > previous pivot high
Bear BOS = new pivot low < previous pivot low
CHoCH logic:
bull_choch = bull_bos AND previous trend was bearish AND bear_count >= 1
bear_choch = bear_bos AND previous trend was bullish AND bull_count >= 1
(Requires at least one confirmed BOS in the opposite direction first)
BOS streak counter:
bull_count increments on each bull_bos, resets to 0 on bear_bos
bear_count increments on each bear_bos, resets to 0 on bull_bos
Bar coloring:
Green = last bull_bos (not CHoCH)
Red = last bear_bos (not CHoCH)
Orange = CHoCH candle only (single bar)
Order Block height:
zone_center = (high + low) / 2 at pivot bar
zone_top = zone_center + ATR(14) x 0.25
zone_bot = zone_center - ATR(14) x 0.25
Fair Value Gap:
bull_fvg = low[0] - high[2] > 0 AND gap_size / close >= min_pct
bear_fvg = low[2] - high[0] > 0 AND gap_size / close >= min_pct
Liquidity Sweep:
bull_sweep = low[1] < lowest(low, N)[1] AND close > that level AND close[1] < that level
bear_sweep = high[1] > highest(high, N)[1] AND close < that level AND close[1] > that level
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
SETTINGS OVERVIEW
Trend Colors:
Fast EMA, Slow EMA, Trend EMA — reference lines on chart
Show EMA lines — toggle EMA display
Show background — toggle trend background coloring
Background opacity — how transparent the background is (80-97)
Smart Money:
Pivot length — bars used for structural pivot detection (default 20)
Show BOS / CHoCH — toggle structure labels and lines
Show Order Blocks — toggle demand/supply zones
OB lookback — pivot length for Order Block detection
Show Fair Value Gaps — toggle FVG boxes
Min FVG size (%) — minimum gap size to display
Show Liq Sweeps — toggle liquidity sweep markers
Sweep lookback — bars used to identify significant highs and lows
Dashboard:
Show Dashboard — toggle info panel
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ALERTS INCLUDED
Bullish CHoCH detected
Bearish CHoCH detected
Bullish Liquidity Sweep
Bearish Liquidity Sweep
Strong Buy: CHoCH plus Sweep aligned bullish
Strong Sell: CHoCH plus Sweep aligned bearish
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
COMPATIBILITY
Works on all assets — Crypto, Forex, Stocks, Futures, Indices.
Works on all timeframes.
Best results on 1H, 4H, and Daily for swing trading.
For scalping use 5m to 15m with reduced pivot length (8 to 12).
No repainting. All signals calculated on confirmed bar close.
No request.security() calls. No lookahead bias.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
DISCLAIMER
This indicator is provided for educational and informational purposes
only. It does not constitute financial advice or a recommendation to
buy or sell any asset. Smart Money Concepts are a trading methodology
and not a guarantee of market direction. Past structural patterns do
not guarantee future price behavior. Always apply your own analysis,
use proper risk management, and never risk more capital than you can
afford to lose. The author is not responsible for any trading losses
incurred from use of this indicator.
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Copy my strategy - copy.mytimebox.app/
TG ENG - t.me/+B_BEn6COneo2ZTBi
TG - t.me/+LTNPinehDNlkZTQy
TG ENG - t.me/+B_BEn6COneo2ZTBi
TG - t.me/+LTNPinehDNlkZTQy
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Copy my strategy - copy.mytimebox.app/
TG ENG - t.me/+B_BEn6COneo2ZTBi
TG - t.me/+LTNPinehDNlkZTQy
TG ENG - t.me/+B_BEn6COneo2ZTBi
TG - t.me/+LTNPinehDNlkZTQy
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.