Skip to content
Strategy lab / 151 Trading Strategies

Strategy lab

Every strategy from 151 Trading Strategies and all 101 Formulaic Alphas as formulas you can edit and backtest on ten years of daily stocks, ETFs, futures, forex and crypto data. Free, in your browser.

Free · runs in your browser · daily data to …

3.17StocksReference

Machine learning – single-stock KNN

Predict each stock’s return over the next few days from the outcomes of the k most similar past situations, where similarity is measured on normalised moving averages of price and volume.

In the paper

Why there is no chart

A model-training step; the formula language does not fit nearest-neighbour searches.

The lab runs on daily prices for stocks, ETFs, indexes, futures, currencies, crypto and Treasury yields. This strategy from 151 Trading Strategies depends on data outside that set, so it is explained and formalised here rather than backtested.

Hypothetical backtests on daily closes with no slippage unless you add costs. Survivorship bias applies: the stock list is today’s large caps. For learning, not investment advice. Data: Yahoo Finance via yfinance.

Section
3.17 · Stocks
Asset class
Stocks
In the lab
Explained, not backtested

Machine learning – single-stock KNN (3.17)

Predict each stock’s return over the next few days from the outcomes of the k most similar past situations, where similarity is measured on normalised moving averages of price and volume.

Key equation

Data it needs

A model-training step; the formula language does not fit nearest-neighbour searches.

More in Stocks

Source: Kakushadze, Z. and Serur, J. A. (2018). 151 Trading Strategies. Palgrave Macmillan. SSRN 3247865. Summaries are our own.