OPEN-SOURCE SCRIPT

AlgoSentry Smart Money Engine [Non-Repaint]

952
AlgoSentry Smart Money Engine [Non-Repaint]

A complete Smart Money Concepts toolkit built on a single rule: nothing is drawn until the candle closes. No repainting, no future leaks, no lookahead. What you see on historical bars is exactly what you would have seen live.

This is one coherent engine, not a bundle of disconnected tools — each layer feeds the next:
Market Structure -> Liquidity Sweep -> Fair Value Gap -> Break of Structure / Change of Character -> Order Block -> Premium / Discount -> Smart Money Score.

────────── What it reads ──────────

Market Structure
Swing highs and lows are detected with confirmed pivots. A swing only prints after a set number of closed bars on each side, so the structure labels (HH, HL, LH, LL) never move once drawn. Labels are off by default for a clean chart — the live bias is always in the dashboard.

Break of Structure & Change of Character
A break registers only when price closes beyond a confirmed swing level. Continuing the trend, it is a Break of Structure (BOS); reversing it after breaking the opposite level, it is a Change of Character (CHoCH). A line is drawn from the broken swing to the break candle.

Displacement Quality
Each break is graded Weak, Valid, or Institutional from candle body strength, ATR expansion, and — where available — volume expansion. It separates a real institutional move from a marginal one.

Liquidity Sweeps
Marked when price wicks beyond a prior swing but closes back inside it: a sell-side sweep below a swing low, a buy-side sweep above a swing high. Each swing is swept once, so the chart stays clean.

Fair Value Gaps
Three-candle imbalances are drawn as zones and tracked through their life — Fresh, Partially mitigated, Filled. Show active gaps only, or keep historical ones faded.

Order Blocks
After a confirmed break, the last opposite candle before that break becomes an order-block zone, tracked as Fresh, Touched, or Invalidated.

Premium / Discount
The last confirmed swing range is split into premium (upper), equilibrium (50%), and discount (lower) — context for where price sits inside its range.

Smart Money Score
A 0-100 context score from the confluence of structure, breaks, sweeps, imbalance, order-block proximity, and trend agreement, reading from Strong Bearish to Strong Bullish. It is a market-context score, not a buy or sell signal.

────────── Why it does not repaint ──────────

Every layer runs on confirmed, closed bars. Pivots require bars on both sides before they confirm. Breaks, sweeps, gaps, and blocks are all evaluated on candle close. There is no security() call, no higher-timeframe lookahead, and no recalculation that moves a past signal. Backtest behaviour matches live behaviour.

────────── How to use it ──────────

Read the dashboard top-down — bias, then the Smart Money Score for context, then the live phase (Accumulation, Expansion, Pullback, Distribution). Use BOS and CHoCH to read structural shifts, sweeps to spot liquidity grabs, and the Fair Value Gap and order-block zones as areas of interest. The optional EMA filter aligns events to the higher-timeframe trend. Alerts are available for every event, all candle-close confirmed.

────────── What it does NOT do ──────────

It does not predict price. It does not give buy or sell signals. It does not place trades or guarantee any outcome. It is a structural and contextual reading tool — the decisions and the risk are yours.

────────── Disclaimer ──────────

For educational and informational purposes only. This is not financial advice. Trading carries substantial risk of loss, and past behaviour does not guarantee future results.

Every signal is confirmed on candle close. No future leaks. No lookahead.

Declinazione di responsabilità

Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.