PROTECTED SOURCE SCRIPT
Demo Indicator: AI Pattern Similarity Algorithm [Nexo Mechanics]

This is a demo indicator inspired by FAISS-style nearest-neighbour search. It performs a pattern similarity search to find historical windows whose return sequence most closely matches the most recent Pattern Length (L) window, then uses the average forward move after those matches to derive a directional bias with a p-value and confidence score.
Pattern Similarity

Prediction Signals
Visuals
Metrics
The indicator is intentionally limited and just for demo purposes. Nothing in this text or in the indicator constitutes financial advice.
Pattern Similarity
- At every confirmed bar, the script builds a query vector from the last Pattern Length (L) bars.
- It then scans backwards through a historical window (Dataset Size) and builds the same vector for every candidate offset.
- The algorithm keeps the Top-K closest matches.
Prediction Signals
- For each of the best matches, the script looks Prediction Horizon (H) bars ahead from that match.
- It computes the future move based on the average move of all matches.
- When the average move flips, a signal is generated (bearish flip or bullish flip).
- We decided to use a normal CDF for p-value approximation and approximate confidence using 1 - p.
- Confidence is used to filter between High Confidence predictions and other predictions.
Visuals
- When a high confidence prediction is triggered, a zone is drawn around the current query window.
- Zones are drawn around the Top-K matching windows found in history.
Metrics
- The table is meant to show only the most recent valid prediction’s metrics
- Best match (bars ago): how far back the closest match ends
- Predicted Move: Avg Move across Top-K (at horizon H)
- p-value / Confidence: statistical strength (heuristic; normal approx)
The indicator is intentionally limited and just for demo purposes. Nothing in this text or in the indicator constitutes financial advice.
Script protegido
Este script se publica como código cerrado. No obstante, puede utilizarlo libremente y sin ninguna limitación. Obtenga más información aquí.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.
Script protegido
Este script se publica como código cerrado. No obstante, puede utilizarlo libremente y sin ninguna limitación. Obtenga más información aquí.
Exención de responsabilidad
La información y las publicaciones no constituyen, ni deben considerarse como asesoramiento o recomendaciones financieras, de inversión, de trading o de otro tipo proporcionadas o respaldadas por TradingView. Más información en Condiciones de uso.