Documentation preview · Content is preliminary and subject to change. Join the waitlist for release notifications.

Version 18 · Decision engine

Secari Square

Technical reference

Secari Decision Engine

Order flow probability layer

Non-overlay oscillator for TradingView — six order-flow analytics fused into one kernel-weighted directional probability engine. No Level II required.

KNN-driven probabilityVolume deltaAbsorptionImbalanceVolume profilePine Script™ v6

© 2026 Secari Square. TradingView® and Pine Script™ are trademarks of their respective owners.

Module reference

Secari Decision Engine

Multi-factor order flow inference engine that converts microstructure signals into probabilistic directional bias.

Last updated April 2026 · Technical spec v18

Overview · Decision Engine v18

Secari Decision Engine v18 is a non-overlay oscillator for TradingView (Pine Script v6) that fuses six order-flow analytics into one KNN-driven directional probability engine. It estimates institutional-style activity through volume delta, absorption, imbalance, divergence, exhaustion, and a binned volume profile — without Level II or tick data.

Design philosophy

  • Signal over noise — configurable cooldown gates cut clustering and false repetition.
  • Probabilistic thinking — directional probabilities P(Up) and P(Down) plus confidence, not binary arrows.
  • Zero repainting — computations use barstate.isconfirmed; pivot divergences confirm with fixed lag; no request.security or lookahead branching.

Engine modules

Volume delta
Candle-based buy/sell estimation with wick-pressure adjustment.
Cumulative delta
Running delta sum with EMA and slope acceleration (SCD).
Absorption
High volume + tight range + balanced delta — institutional wall heuristic.
Imbalance
High volume + wide range + extreme delta — aggressive sweep.
Divergence
Price vs. cumulative delta structure on swing pivots.
Exhaustion
Climactic volume + extreme delta — potential move termination.
Volume profile
20-bin POC, VAH, VAL over a configurable lookback.
KNN probability
Six-feature similarity search yielding P(Up), P(Dn), confidence.
Composite bias
Weighted blend of signals into a single score on [-100, +100].

Order-flow mathematics

Without true bid/ask tape, the engine estimates buying vs. selling from candle geometry: range R, upper/lower wicks, and close location beta. A ±15% wick adjustment shifts beta when long lower wicks suggest buy-side absorption at lows (and the converse at highs).

Delta & cumulative delta

Per-bar delta is buy volume minus sell volume. Cumulative delta (CD) sums deltas. A Z-score of raw delta vs. its SMA and standard deviation flags extremes (beyond about ±2 is statistically notable). SCD is a 5-bar CD momentum smoothed over 10 bars.

Absorption scoring

Absorption score A blends volume spike vs. average, normalized range vs. ATR14, and how balanced delta is vs. total volume. Detection fires when A > 65.

Absorption is a reversal precursor, not a direction by itself. Contextualize with CD slope and composite bias.

Imbalance scoring

Imbalance I rewards volume spikes, wide range vs. ATR, and extreme Z-delta. Threshold I > 70 with delta sign yields bull vs. bear imbalance. Consecutive same-direction imbalances increment a stack counter; k ≥ 2 suggests sustained aggression.

Divergence & exhaustion

Swing pivots (N = 7 bars) compare price pivots to CD pivots with a 0.5×ATR minimum gap to avoid noise. Bullish divergence: price lower low, CD higher low; bearish: price higher high, CD lower high. Exhaustion requires simultaneous volume Z > 2.5, delta Z beyond ±2.5, and range above 1.0×ATR.

Volume profile

Over L bars the engine bins mid-prices into 20 levels between period high and low, finds POC (max volume bin), then expands a 70% value area from POC upward and downward. Distance to POC is normalized by ATR14 for feature use.

KNN probability engine

Instead of a fixed K and majority vote, the engine uses kernel-weighted similarity over a depth of historical bars — closer past states dominate; distant ones fade out (Nadaraya–Watson style).

Six-dimensional feature vector

f1 · ZΔ
Delta extremeness vs. recent history (roughly ±3).
f2 · CD accel.
SCD scaled — pressure acceleration / deceleration.
f3 · Absorption
A/100 — wall presence [0, 1].
f4 · Imbalance
(I/100) · sign(Δ) — sweep direction and magnitude [-1, 1].
f5 · POC dist.
Price vs. POC in ATR units — mean-reversion context.
f6 · Vol spike
Capped participation level [0, 1].

Similarity & probabilities

Log-distance d = Σ ln(1 + |fi,t − fi,t−ℓ|) dampens outlier dimensions. Weight w = 1/(1+d). For each lag ℓ, forward return over F bars (default 5) votes up or down. Raw P(Up) and P(Dn) are kernel-weighted fractions, then smoothed with a 3-bar EMA. Confidence = |P(Up) − 0.5| × 200 (0–100).

Traditional KNN struggles here: optimal K is unknown per symbol/timeframe, and equal weights ignore how close a match is. This formulation uses all lags with similarity weights instead.

Composite bias, visuals & dashboard

Composite bias B on [-100, +100] clamps and combines Z-delta, probability skew (P(Up)−0.5), and small contributions from imbalance (+/−10), absorption (+/−5 by close vs. open), and divergence (+/−10).

B > +50
STRONG LONG — high-conviction bullish.
+20 to +50
LONG — moderate bullish lean.
−20 to +20
NEUTRAL — no clear edge.
−50 to −20
SHORT — moderate bearish lean.
B < −50
STRONG SHORT — high-conviction bearish.

Cooldown system

Each signal family keeps its own bar counter. A raw signal only passes if τ ≥ τcd (default 10 bars, range about 3–50). Separate counters cover absorption, bull/bear imbalance, divergences, and exhaustion.

Display modes

Delta
Per-bar delta histogram (intensity from |ZΔ|) plus SMA.
Cumulative delta
CD line + EMA with directional fill.
Probability
P(Up) and P(Dn) vs. 50% with fills.

Signal shapes anchor in tiers (e.g. absorption/imbalance near ±5% of pane range; divergence/exhaustion near ±12%). Histogram bar alpha scales with delta extremity so weak flow looks transparent and extreme flow reads solid.

Dashboard rows (abridged)

Bias
Directional label plus |B| bar graph.
P(Up) / P(Dn)
Percentage fill bars.
Confidence
Fill bar 0–100%.
Delta
Raw value and Z-score.
Absorption / Imbal.
Scores, flags, stack state.
Vol spike / POC
Participation and VA position.

Parameter reference (defaults)

Order flow engine

Delta smoothing
Default 14 (min 5, max 50) — SMA length for Δ̄; lower reacts faster.
Absorption lookback
Default 20 (10–50) — volume average window.
Volume profile bars
Default 50 (20–200) — L for POC/VA construction.

Probability engine

KNN lookback depth
Default 60 (30–150) — historical bars scanned.
KNN start offset
Default 10 (5–30) — minimum lag to reduce lookahead bias.
Forward result bars
Default F = 5 (2–20) — horizon for labeling past outcomes.

Display & theme

Toggles control absorption diamonds, imbalance arrows, DIV labels, exhaustion crosses, and background zones. Theme pickers assign bullish (#00E676), bearish (#FF1744), warning (#FFAB00), accent (#448AFF), and neutral (#787B86) roles across UI elements.

Alerts & usage

Built-in alerts fire on cooldown-gated conditions (abbreviated):

Absorption
A > 65 — wall / reversal zone.
Bull / bear imbalance
I > 70 with delta sign.
Divergences
Pivot-confirmed bullish/bearish structure.
Exhaustion
Climactic bull/bear per Z rules.
High confidence
Confidence > 70%.
Strong long / short
B beyond ±50.

Quick start

  • Add the indicator in its own pane.
  • Pick a display mode (delta, cumulative delta, or probability).
  • Read bias and dashboard for a fast directional read.
  • Watch tier-anchored shapes at the pane edges.
  • Attach alerts to the conditions that match your playbook.

Confluence ideas

  • Bullish: B > +50 with P(Up) > 60% and confidence > 60%, plus bull imbalance or stack ≥ 2, price near/below VAL, CD slope positive.
  • Bearish: mirror with P(Dn), bear imbalance, price near/above VAH, CD slope negative.
  • Caution: exhaustion with your trend, absorption against you, divergence against you, or confidence under ~30%.
Scalping 1m–5m
Consider longer cooldown (about 15–20 bars).
Day trade 5m–15m
Defaults often fit well.
Swing 1H–4H
Try KNN lookback 100–150.
Position daily
Widen volume profile lookback toward 100–200 bars.

Technical properties

  • KNN and profile: gated on confirmed bars only.
  • Divergences: pivot confirmation introduces a fixed lag (7 bars).
  • No external requests — no request.security().
  • No realtime-only branches that repaint intrabar conclusions.
  • Designed to be backtest-safe at historical resolution.

Rough per-bar cost scales with KNN depth D and profile length L (on the order of D + L operations at defaults — tractable on TradingView).

Limitations & disclaimers

  • Delta is estimated — without Level II, classification is approximate.
  • Binned profile (20 levels) summarizes structure; not tick-precision.
  • KNN is backward-looking — regime breaks can invalidate historical analogs.
  • Tooling is a confluence layer — pair with price action and risk rules.
  • Volume quality varies (e.g. forex tick volume vs. centralized venues).
Trading involves substantial risk. Secari Decision Engine v18 is analytical software, not investment advice. Do not risk capital you cannot afford to lose.

Platforms & installation

This specification describes the TradingView Pine Script v6 build. A NinjaTrader 8 port may follow the same conceptual stack where platform APIs allow; check your delivery materials for the exact build you received.

After purchase (when sales are open), use the license email to add the script, validate loads in the editor, then paper-test before live use.

Want in on the build? Hit the team.