Turn the moving averages, the MACD, the RSI, the Bollinger Bands and new highs and lows into the events traders act on: the period a line is crossed. The indicators themselves are available as get_moving_average, get_moving_average_convergence_divergence, get_relative_strength_index and get_bollinger_bands, and give the same values.

Every signal is 1 on the period a line is crossed upwards, -1 on the period it is crossed downwards and 0 otherwise:

  • Moving Average Crossover: the short Simple Moving Average crossing the long one; with the default 50 and 200 periods a golden cross (1) or a death cross (-1).
  • MACD Crossover: the MACD line crossing its signal line, the classic trigger of the MACD.
  • RSI Overbought: the RSI entering (1) or leaving (-1) the overbought zone above rsi_overbought. Leaving it is the classic sell signal.
  • RSI Oversold: the RSI leaving (1) or entering (-1) the oversold zone below rsi_oversold. Leaving it is the classic buy signal.
  • Upper Bollinger Band: the price breaking out above (1) or falling back below (-1) the upper band.
  • Lower Bollinger Band: the price recovering above (1) or breaking down below (-1) the lower band.
  • New High/Low: a close above every close of the previous high_low_window periods (1), a 52-week high with daily prices by default, or below every one of them (-1).

For more information, see the following books and papers:

  • Murphy, J.J. (1999). “Technical Analysis of the Financial Markets.” New York Institute of Finance.
  • Appel, G. (1979). “The Moving Average Convergence-Divergence Trading Method.” Signalert Corp.
  • Wilder, J.W. Jr. (1978). “New Concepts in Technical Trading Systems.” Trend Research.
  • Bollinger, J. (2001). “Bollinger on Bollinger Bands.” McGraw-Hill.
  • Brock, W., Lakonishok, J., and LeBaron, B. (1992). “Simple Technical Trading Rules and the Stochastic Properties of Stock Returns.” The Journal of Finance, 47(5), 1731-1764.

Also known as: trading signals, golden cross, death cross, crossovers, breakouts, MACD crossover, RSI signal, 52-week high, new high.

Signals in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_signals as shown below.

from financetoolkit import Toolkit

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

signals = toolkit.technicals.get_signals()

crossovers = signals["Moving Average Crossover"]
crossovers[crossovers.ne(0).any(axis=1)].tail()

Which returns:

Date AAPL MSFT Benchmark
2025-04-07 -1 0 0
2025-04-16 0 0 -1
2025-06-09 0 1 0
2025-06-27 0 0 1
2025-09-15 1 0 0

Parameters

get_signals accepts the following parameters.

ParameterTypeDescriptionExample
periodstrThe time period to consider for historical data. Can be “intraday”, “daily”, “weekly”, “monthly”, “quarterly” or “yearly”. Defaults to “daily”."weekly"
close_columnstrThe column name for closing prices in the historical data. Defaults to “Adj Close”."Close"
short_windowintThe window of the short moving average. Defaults to 50.50
long_windowintThe window of the long moving average. Defaults to 200.200
macd_short_windowintThe short window of the MACD. Defaults to 12.12
macd_long_windowintThe long window of the MACD. Defaults to 26.26
macd_signal_windowintThe window of the MACD’s signal line. Defaults to 9.9
rsi_windowintThe window of the RSI. Defaults to 14.14
rsi_overboughtfloatThe RSI above which a price is overbought. Defaults to 70.70
rsi_oversoldfloatThe RSI below which a price is oversold. Defaults to 30.30
bollinger_windowintThe window of the Bollinger Bands. Defaults to 20.20
bollinger_std_devfloatThe number of standard deviations of the Bollinger Bands. Defaults to 2.2
high_low_windowint | NoneThe number of previous periods a new high or low is measured against. Defaults to None, which uses a year of periods: 252 daily (and intraday), 52 weekly, 12 monthly, 4 quarterly and 1 yearly.None, which uses a year of periods: 252 daily (and intraday), 52 weekly, 12 monthly, 4 quarterly and 1 yearly
Share