> For the complete documentation index, see [llms.txt](https://docs.stockhero.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stockhero.ai/technical-indicators/macd.md).

# MACD

The Moving Average Convergence Divergence (MACD) technical indicator is a popular trend prediction tool that provides an indication of a bull or bear inflection point.

MACD consists of three key parameters, namely the slow and fast periods, and the signal lines. The MACD line is formed by subtracting the value of the slow period from the value of the fast period. The standard is 26 for the slow period and 12 for the fast period.

## Determining the Trends

Traders often make use of the crossover between the MACD and Signal line to determine if the market is heading into a bullish or bearish phase.&#x20;

* If the MACD line crosses the Signal line from below to above, it is generally considered bullish.
* If the MACD line crosses the Signal line from above to below, it is generally considered bearish.

The crossovers are often triggers for traders to enter or exit a position.

![(Bullish Trend)](https://4210655246-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5LiMstpewrLGU6auaX%2F-MjrSFWISKxzsA5w__NC%2F-MjrXYHhLMhNRxvaGR8t%2FScreenshot%202021-09-18%20at%202.13.16%20PM.png?alt=media\&token=737419af-4e10-4fb8-b420-8bd632df7d96)

From the graph above, we can see that the MACD line (blue line) crosses the signal line (red line) on or near Aug 31, 2021. The following few days resulted in a bullish uptrend for the stock.

![(Bearish Trend)](https://4210655246-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-M5LiMstpewrLGU6auaX%2F-MjrSFWISKxzsA5w__NC%2F-MjrXy7rrW0bQlkkl-cv%2FScreenshot%202021-09-18%20at%202.13.31%20PM.png?alt=media\&token=5c9862c9-03db-456f-be77-23b6e0e8266f)

For the same stock, the previous bullish trend turned around to a bearish trend on September 7. As the chart shows, the MACD line has dropped from above to below the signal line.

For seasoned traders, StockHero offers the ability for them to configure the specific values for the fast and slow periods as well as the signal line period.&#x20;


---

# 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.stockhero.ai/technical-indicators/macd.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.
