Reversal Probability & Signals
Apr 17, 2026

The Reversal Probability & Signals indicator provides a real-time estimation of the likelihood of market tops and bottoms by utilizing a simplified K-Nearest Neighbors (KNN) machine learning algorithm.
Usage
The Reversal Probability & Signals tool can be used to identify high-probability reversal zones and specific entry triggers. It functions as a pattern recognition engine that compares current momentum against historical reversal states.
- Identifying Exhaustion: When the probability histogram rises above the Upper Threshold (default 80%), the market is entering a state that historically precedes a pivot. Users should observe this as a "standby" phase.
- Triggering Entries: A signal is generated when the probability peaks above the threshold and subsequently falls below the Lower Threshold. This confirms that the extreme momentum has shifted, suggesting the reversal is underway.
- Target Selection: Users can toggle the indicator between "BOTTOM" (to find long entries at pivot lows) or "TOP" (to find short entries at pivot highs).
Details
The script utilizes a KNN classification model built in Pine Script. It processes data through three distinct stages:
- Feature Extraction: It calculates eight different lengths of the Commodity Channel Index (CCI), ranging from short-term (20) to long-term (400) periods, to create a multi-dimensional momentum profile.
- Training Data: The script identifies historical pivot points (Top/Bottom) and stores the corresponding CCI values. It also collects random non-pivot samples to ensure a balanced dataset.
- Euclidean Distance: For every new bar, the algorithm calculates the mathematical distance between current CCI values and the stored historical samples. The output probability represents the percentage of the "K" nearest neighbors that were actual historical reversals.
Settings
General Settings
- Prediction Target: Choose between predicting market BOTTOMS (Pivot Lows) or TOPS (Pivot Highs).
Feature Parameters (CCI)
- CCI Lengths 1-8: Adjustable periods for the momentum features used in the KNN model.
KNN Model Settings
- KNN K-Value: The number of nearest neighbors to compare. The script dynamically scales this value as the database grows.
- Max Samples per Class: The maximum memory limit for stored historical data points.
Pivot Definition
- Pivot Left/Right Bars: Determines the lookback and lookahead required to confirm a structural pivot point.
Signal Settings
- Signal Upper Threshold: The probability level required to enter the "standby" state.
- Signal Lower Threshold: The probability level required to trigger the actual signal after being in standby.
- ATR Offset: Controls the vertical distance of the signal shapes from the price bars.
FAQ
How do I use the "Standby" vs "Trigger" logic?
The "Standby" occurs when the probability exceeds the upper threshold (e.g., 80%), signaling extreme conditions. The "Trigger" occurs only after the probability then drops below the lower threshold, confirming a change in momentum.
Why does the indicator take time to show accurate probabilities?
Because the KNN model "learns" from the current chart's history, it needs to collect enough pivot samples to build a reliable database. The "K" value scales dynamically as more data is collected.
How can I access this indicator?
You can get access on the LuxAlgo Library for charting platforms like TradingView, MetaTrader (MT4/MT5), and NinjaTrader for free.
Trading & investing are risky and many will lose money in connection with trading and investing activities. All content on this site is not intended to, and should not be, construed as financial advice. Decisions to buy, sell, hold or trade in securities, commodities and other investments involve risk and are best made based on the advice of qualified financial professionals. Past performance does not guarantee future results.
Hypothetical or Simulated performance results have certain limitations. Unlike an actual performance record, simulated results do not represent actual trading. Also, since the trades have not been executed, the results may have under-or-over compensated for the impact, if any, of certain market factors, including, but not limited to, lack of liquidity. Simulated trading programs in general are designed with the benefit of hindsight, and are based on historical information. No representation is being made that any account will or is likely to achieve profit or losses similar to those shown.
Testimonials appearing on this website may not be representative of other clients or customers and is not a guarantee of future performance or success.
As a provider of technical analysis tools and strategies, we do not have access to the personal trading accounts or brokerage statements of our customers. As a result, we have no reason to believe our customers perform better or worse than traders as a whole based on any content, tool, or platform feature we provide.
Charts used on this site are by TradingView in which the majority of our technical indicators are built on. TradingView® is a registered trademark of TradingView, Inc. www.TradingView.com TradingView® has no affiliation with the owner, developer, or provider of the Services described herein.
Market data is provided by CBOE, CME Group, BarChart, Massive, CoinAPI. Select U.S. equities data is provided through Massive. CBOE BZX real-time U.S. equities data is licensed from CBOE and provided through BarChart. Real-time futures data is licensed from CME Group and provided through BarChart. Select cryptocurrency data, including major coins, is provided through CoinAPI. All data is provided “as is” and should be verified independently for trading purposes.
This does not represent our full Disclaimer. Please read our full disclaimer.
© 2026 LuxAlgo Global, LLC.

