> For the complete documentation index, see [llms.txt](https://docs.candelacharts.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.candelacharts.com/oscillators/momentum-concepts/reversals.md).

# Reversals

The **Reversal Engine** is one of the most advanced components of Momentum Concepts. It uses a **K-Nearest Neighbors (KNN)** algorithm to calculate the statistical probability of a top or bottom.

<figure><img src="https://3870127617-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCBVnUk5c5TVytimjy972%2Fuploads%2F1QDqmX82KfuwrkbI3exv%2Fdocs-momentum-concepts-005.png?alt=media&amp;token=4f60509f-a1d2-451d-a300-aad29b973957" alt=""><figcaption></figcaption></figure>

### How KNN Works

1. **Feature Extraction**: It tracks 8 dimensions of momentum (CCI over multiple timeframes).
2. **Historical Comparison**: Every new candle, the engine looks back at your "Max Samples" and finds the "K" most similar historical patterns.
3. **Probability Scoring**:
   * If most similar patterns in the past led to a bottom, the **Bottom Probability** increases.
   * If they led to a top, the **Top Probability** increases.

### Signal Threshold

By default, the **Signal Threshold** is set to 80%. When the probability of a reversal crosses this line, the engine is "Primed".

### Reversal Markers

* **Upward Triangle**: Triggers when the Bottom Probability crosses back under the threshold after reaching an extreme. Indicates a confirmed bottoming pattern.
* **Downward Triangle**: Triggers when the Top Probability crosses back under the threshold after reaching an extreme. Indicates a confirmed topping pattern.

### Sensitivity

* **K-Value**: Lower values make the engine more sensitive; higher values make it more stable.
* **Max Samples**: Increasing this provides more historical context but requires more processing power.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.candelacharts.com/oscillators/momentum-concepts/reversals.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
