Streaming ML Stochastic Triple Barrier, Conformal and Calibrated — Indicator from Market_Logic_India — TradingView

Machine Learning


Streaming ML probabilities — triple barrier, conformal, calibrated

what is it

A self-trained probabilistic model that estimates P (the up barrier is resolved before the down barrier) and, importantly, reports its own calibration. Differentiators are not classifiers. It’s the label and the layer of honesty around it. This pane displays probabilities, honest uncertainty bands, plain language decisions, and a confidence diagram that indicates whether you believe any of them.

Why these components belong to one script (not a stack of indicators)

These are stages in one honest prediction pipeline, each fixing a failure mode in a simple “ML” overlay.

The triple barrier label defines what is expected as an actual path-dependent outcome (which barrier will be hit first) rather than an arbitrary “what’s the next bar?” and is resolved forward in time, so training only sees the seen results and there is no lookahead.
Z-scored bounded features keep all inputs finite, so no single bar explodes the online weights.
Logistic SGD + Lorentzian k-NN, fused with log-odds and Kish uncorrelated shrinkage – combines a linear model of propensity with a nonlinear structure of fat-tailed neighbor voting without double-counting shared features.
The regime engine (Efficiency + ADX + Hawks) gives each market state its own adjustment, shrinking the probability towards 0.5 if a regime is rarely seen. The model will follow a coin toss that it has not learned.
Adaptive conformal inference transforms point estimates into coverage-controlled bands that hold even under drift, so the uncertainties are honest instead of spurious point estimates.
Conviction + strong veto powers (regime, MTF, participation/CVD, calibration quality) to stop models from operating based on unsupported numbers.
The calibration harness (reliability table, Brier score, and forward edge to unconditional base rate) is important. Probability is only useful if 70% means 70%.

Labels tell you what to learn, features feed it, fused classifiers predict, regime + conformal tells you how much to trust it, veto gates it, and calibration proves whether any of that is the case. Removing the stage removes integrity. That’s why it ships as one engine.

Mechanism (mechanics)

Each confirmed bar opens a triple barrier sample (unless the OU half-life indicates that reversion is too slow to resolve in the future). Once the samples are solved, the model performs one online gradient step on its own features and results, the solved samples go into the k-NN memory, and the misfit scores update the conformal bands via Gibbs-Candès ACI. The live probabilities are the log-odds fusion of the logistic output and the Lorentzian k-NN vote with regime contraction during warmup. A directional signal is fired only if the probability band clears the signal margin, the conviction clears its lower bound, and no strong veto is triggered. All resolved directional calls are scored against unconditional co-region base rates (hit% vs. base%, Wilson bounds, regime and current weighting).

Non-redraw: Train only without resolved triple barrier results, signal on bar exit, MTF requested with lookahead_off, dynamic length ta(). Live probability updates each bar. That is, the current estimate from fixed history training.

How to use

Read the VERDICT line first. Based on the live signal and the model’s own calibration, it can be either ACT, STAND ASIDE (no calibrated edges), or WAIT.
Please check the reliability diagram/Brier. Points off the diagonal, or Briar ≥ 0.25 (worse than a coin toss), mean the probability is not yet reliable. The engine tells you to stand aside.
The signal fires only upon merging. There is no probability of exceeding the band margin, no certainty of exceeding the lower bound, and no strong veto power.
Conformal bands are honest uncertainties, and wider bands mean less confidence.
Everything here is descriptive and probabilistic context and is in no way instructional.

Honesty note: With pure daytime noise (e.g. NIFTY 1 minute), this model will often show NO EDGE/VETO at the briar, worse than a coin toss. And it’s not making up a signal, it’s saying it loud and clear. That’s the intended behavior.

Can be used in any market

Data source inputs (close price/high price/low price/volume) drive the function, triple barrier label, and calibration, so the model works on any series (standard candlestick, Heikin Ashi, etc.) and any market. All thresholds are ATR relative. The default is set to intraday trading of NIFTY index futures. Change the source or length of other assets. Assets without volume simply do not contribute anything through volume functionality.

originality

Most “machine learning” indicators output unadjusted scores that are never checked against what actually happened. The contribution here is a closed and honest loop. Real path-dependent labels, fused but uncorrelated classifiers, regime conditional contraction, drift-robust conformal bands, confidence/rejection gating, and a built-in confidence + briar + edge harness that can, and often does, tell you that your model currently has no edges. It is built to be falsifiable, the opposite of most signal scripts.

credit

Triple barrier labeling and meta-labeling — Marcos López de Prado
Logistic regression/SGD — classic statistics
Lorentzian (non-Euclidean) distance for k-NN — Relativistic distance concept
Conformal Prediction — Vovk, Gammerman, Shafer; Adaptive Conformal Inference — Gibbs & Candès
Brier Score — Glenn W. Brier
Wilson Scoring Interval — Edwin B. Wilson
Efficiency Ratio — Perry Kaufman · ADX / DMI — J. Welles Wilder
Hawks’ Self-Stimulating Process — Alan G. Hawks
Ornstein-Uhlenbeck / AR(1) half-life — Ornstein and Uhlenbeck
Decorrelation of valid samples — Leslie Kish

Pipeline assembly, regime conditional calibration, and conviction/veto layers are the authors’ original implementations.

Limit (honesty)

Properly adjusted probabilities are not favorable when considering costs. The forward statistics are within the sample, close to a fixed period, with no costs, no slippage, and no stops. This is research assistance, not backtesting. The model is small (6 features, online weights). It warms up slowly and often stays on the side. Past actions do not guarantee future actions.

Disclaimer

Education/information learning for chart analysis only. It does not constitute financial advice, strategies, or recommendations. No orders are placed and results are not guaranteed. Markets involve risks. Do your own research and manage your own risks. Make paper trades before risking real money.



Source link