Member-only story

Coding a simple Moving Average Crossover strategy with Python

Luiggi Trejo
2 min readDec 21, 2022

--

Photo by Maxim Hopman on Unsplash

Moving average crossovers are a common technique used in technical analysis for identifying trends and making trading decisions.

A moving average is a statistical measure that smooths out short-term fluctuations in data and highlights longer-term trends. There are several types of moving averages, including the simple moving average (SMA), which is calculated by taking the average of a set of values over a given time period, and the exponential moving average (EMA), which gives more weight to recent values.

When using moving averages for trading, traders often look for crossovers or instances where two different moving averages intersect. For example, a trader might use a shorter-term moving average, such as a 15-period SMA, and a longer-term moving average, such as a 150-period SMA, and look for instances where the shorter-term moving average crosses above or below the longer-term moving average.

If the shorter-term moving average crosses above the longer-term moving average, it can be a bullish signal, indicating that the trend is shifting upwards. Conversely, if the shorter-term moving average crosses below the longer-term moving average, it can be a bearish signal, indicating that the trend is shifting downwards.

--

--

Luiggi Trejo
Luiggi Trejo

No responses yet