Archer Moving Averages Trends (AMAT)

Calculate Archer’s Moving Averages Trends (AMAT): whether a fast and a slow moving average both rise (a long run) or both fall (a short run), which shows the direction of a trend.

AMAT flags a long run when the short moving average rose over the last lookback periods while the long one moved (a rising long average confirms the up trend, a falling one marks a potential bottom), and a short run when the short average fell while the long one moved (a potential top when the long one still rose). Both flags are 0 when the short average is flat or the long one did not move.

The formula is as follows:

\[\text{Long Run} = 1 \;\text{if MA}(\text{Close},\; \text{short\_window}) \;\text{rose over} \;\text{lookback} \;\text{periods and MA}(\text{Close},\; \text{long\_window}) \;\text{changed},\;\; \text{else 0}\] \[\text{Short Run} = 1 \;\text{if MA}(\text{Close},\; \text{short\_window}) \;\text{fell over} \;\text{lookback} \;\text{periods and MA}(\text{Close},\; \text{long\_window}) \;\text{changed},\;\; \text{else 0}\]

with MA the exponential moving average by default.

Also known as: AMAT, Archer Moving Averages Trends.

Example · AAPL, MSFT · 2024 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_archer_moving_average_trends:

from financetoolkit import Toolkit

toolkit = Toolkit(
    tickers=["AAPL", "MSFT"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2024-01-01",
    end_date="2025-12-31",
)

toolkit.technicals.get_archer_moving_average_trends().xs("AAPL", level=1, axis="columns")

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

On which days in 2025 did the Archer moving average trends signal a long or a short run for Apple?

Which returns:

Parameters

get_archer_moving_average_trends accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe time period to consider for historical data. Options are: “intraday” (intraday prices), “daily” (daily prices), “weekly” (weekly prices), “monthly” (monthly prices), “quarterly” (quarterly prices), “yearly” (yearly prices). Defaults to “daily”."weekly"
close_columnstrThe column name for closing prices in the historical data. Defaults to “Adj Close”."Close"
short_windowintThe number of periods of the short moving average. Defaults to 8.8
long_windowintThe number of periods of the long moving average. Defaults to 21.21
lookbackintThe number of periods over which the averages rise or fall. Defaults to 2.2
moving_averagestrThe moving average. Options are: “simple” (Simple Moving Average), “exponential” (Exponential Moving Average), “double_exponential” (Double Exponential Moving Average), “triangular” (Triangular Moving Average), “weighted” (Weighted Moving Average), “hull” (Hull Moving Average), “kaufman_adaptive” (Kaufman Adaptive Moving Average). Defaults to “exponential”."exponential"
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
growthboolWhether to calculate the growth of the AMAT. Defaults to False.True
lagint | list[int]The lag to use for the growth calculation. Defaults to 1.4
standardizeboolWhether to standardize (Z-Score) the result. When combined with growth=True, standardizes the growth values instead of the raw values. Defaults to False.True
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Archer’s TradingView script “Archer Moving Averages Trends”, which defines the indicator; there is no published primary source.
  • Library Referenced against pandas-ta-classic’s amat
Share