> 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="/files/2QVgspFUMcdWg79Eh9y7" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
