> For the complete documentation index, see [llms.txt](https://algopro.gitbook.io/traders-trail-faq/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://algopro.gitbook.io/traders-trail-faq/algopro-market-matrix/divergence-detector.md).

# Divergence Detector

#### Divergence Detector

Divergence is a powerful trading concept that helps traders spot potential reversals by comparing price movements with technical indicators. When the price is moving in one direction, but an indicator is moving in the opposite direction, this is called **divergence** and often signals that the current trend may be losing strength. The Divergence Detector automatically finds these divergences, helping you anticipate potential market turning points.

<figure><img src="/files/nOzgQxN4XFkwqEQfZ9JY" alt=""><figcaption></figcaption></figure>

**How It Works**

1. **Types of Divergence:**
   * **Regular Divergence:** Occurs when the price makes a higher high (in an uptrend) or a lower low (in a downtrend), but the indicator moves in the opposite direction. This suggests that the current trend is weakening and a reversal could happen soon.
   * **Hidden Divergence:** Occurs when the price makes a higher low (in an uptrend) or a lower high (in a downtrend), but the indicator moves in the opposite direction. Hidden divergence often signals that the trend will continue.
2. **Indicator Options:** The tool checks for divergences using multiple indicators, including the **MACD**, **RSI**, **Stochastic**, **Momentum**, and others.
3. **Divergence Labels:** The tool adds text labels above or below the bars where divergences are detected, showing how many indicators triggered the signal. This provides you with additional clarity on the strength of the divergence. A 1 would mean 1 indicator has triggered a divergence, a 3 would mean 3 indicators have triggered a divergence, etc.
4. **Customization:** You can control the **lookback period** to check how far back the tool should search for divergences, adjust the **strength of divergence** required for a signal to show, and choose whether to display the divergence lines and labels on your chart.

**Why It Matters**

* **Spotting Reversals Early:** Divergence is one of the most reliable ways to catch trend reversals before they happen. By identifying when momentum is fading or increasing, you can better time your entries and exits.
* **Confirming Trade Setups:** Divergence adds an extra layer of confirmation to your trading decisions. If your strategy indicates a buy or sell signal and a divergence appears at the same time, it adds confluence and increases the probability of a successful trade.
* **Adapting to Market Conditions:** Whether you're trading trending or ranging markets, divergence helps you stay ahead of potential market shifts. Regular divergence often signals reversals, while hidden divergence helps you spot trend continuations.

In summary, the Divergence Detector helps you visualize and understand key moments when price action and indicators are diverging, offering clear signals for potential reversals or trend continuations. It provides traders with an advanced method to anticipate changes in market direction, making it a valuable part of any trading strategy.


---

# 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://algopro.gitbook.io/traders-trail-faq/algopro-market-matrix/divergence-detector.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.
