liveBook · Manning

Moving average crossover

As explained in Investing for Programmers

A moving average crossover is a trading rule that generates signals when moving averages calculated over different time windows intersect.

A moving average crossover generates trading signals when averages calculated over different windows intersect. A shorter SMA above a longer SMA triggers a buy condition; falling below it triggers a sell condition. section 11.3.1

NVIDIA parameter testing

An SMA10/SMA20 test on NVIDIA underperformed simply buying at the start and selling later. Other windows produced higher historical gains, with 90/120 reaching $309,821.27 in the reported ten-year test. Splits, starting and ending prices, transaction costs, and taxation can distort such comparisons. section 11.3.1

How Investing for Programmers covers it

How deep it goes
Explains rolling averages, trade-state logic, parameter sweeps, and returns, but stops short of live execution.
Examples
Uses NVIDIA, Coca-Cola, 3M, Pfizer, Apple, and Microsoft historical-share backtests with varied SMA windows.
What it assumes
Assumes familiarity with historical price data and pandas DataFrames while demonstrating SMA calculation and trade simulation directly.
What you can do after
Diagnose/debug with it by implementing and comparing crossover backtests across assets, windows, and transaction-cost assumptions.
How it connects
Connects simple moving averages with backtesting, transaction costs, taxation, and buy-and-hold comparison.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Investing for Programmers. The section links point to the parts of the book it draws on.