# AlphaTrend Trading Strategy

**Sample AFL Code - AlphaTrend Trading Strategy**

**What is Alphatrend?**\
Alpha Trend tries to solve those problems such as:\
1-To minimize stop losses and overcome sideways market conditions.\
2-To have more accurate BUY/SELL signals during trending market conditions.\
3- To have significant support and resistance levels.\
4- To bring together indicators from different categories that are compatible with each other and make a meaningful combination regarding momentum, trend, volatility, volume and trailing stop loss.\
\
**Purposes of Alpha Trend:**\
1- Acts like a dead indicator like its ancestor Magic Trendin sideways market conditions and doesnâ€™t give many false signals.\
2- With another line with 2 bars offset off the original one Alpha Trend has BUY and SELL signals from their crossovers.\
\
**Trading Rules**\
BUY when AlphaTrend line crosses above its 2 bars offset line\
SELL when Alpha Trend line crosses below its 2 bars offset line<br>

&#x20;<mark style="color:blue;">Download Sample Code here</mark>

{% file src="/files/ysp0T3uHlRPAnL8rj93U" %}


---

# Agent Instructions: 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:

```
GET https://docs.algomojo.com/algomojo/strategies/amibroker/alphatrend-trading-strategy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
