Free trial
Menu
Learn guide

Predicting Price Action with Supervised Learning

Machine learning uses algorithms that learn patterns from data rather than following rules written by hand. In trading, it is used to forecast short-term moves, classify market conditions, size positions and execute orders. It is also one of the easiest ways to fool yourself, because financial data is noisy and powerful models can find patterns that are not there.

QuantPower Research · Updated 3 Nov 2026 · 5 min read

This guide explains how supervised learning is applied to price prediction, what it takes to build a model properly, the pitfalls specific to markets, what machine learning can and cannot do, and how SEBI's rules apply to strategies built on it.

What supervised learning is

Supervised learning trains a model on examples where the answer is known. Each example has:

  • Features: the inputs, such as recent returns, volatility, volume or option data.
  • A label: the outcome to predict, such as whether Nifty rises over the next 30 minutes, or by how much.

The model learns a relationship between features and labels on past data, then makes predictions on new data.

Common models

ModelStrengthsWeaknesses
Linear and logistic regressionSimple, fast, interpretableMisses non-linear patterns
Decision trees and random forestsCapture interactions, handle mixed dataCan overfit without limits
Gradient-boosted treesOften strong on tabular dataMany settings to tune
Neural networksFlexible, handle large and complex dataNeed much data, hard to interpret, easy to overfit

In research on predicting stock returns, such as Gu, Kelly and Xiu's large study of US stocks, tree-based models and neural networks have improved on linear models, but the gains were modest relative to the noise in returns. Prediction in markets is hard even for the best models.

Building a model properly

  1. Define the question. For example: will the next 30-minute return of Nifty futures be positive?
  2. Build features from past data only. Every feature must be known at the moment of the prediction.
  3. Split data by time. Train on an earlier period, validate on a later one, test on the latest. Never shuffle time series data randomly, which lets the model learn from the future.
  4. Tune on validation, judge on test. Use the test period once, at the end.
  5. Walk forward. Retrain on a rolling window and test on the next period, repeatedly. See walk-forward testing.
  6. Turn predictions into a strategy. Decide how a prediction becomes a trade: thresholds, position size and exits.
  7. Include costs. A model can be accurate and still lose money if its edge is smaller than costs.
Diagram of market data split by time into train, validate and test periods, against a random shuffle, with walk-forward windows (illustration)

Pitfalls specific to markets

Data leakage

Leakage happens when information from the future slips into the features. Common examples: using the day's closing price to predict an intraday move, normalising data using statistics from the whole dataset, or labels that overlap with the next training example. Leakage produces models that look brilliant and fail live.

Non-stationarity

Markets change. Relationships that held in one period can weaken or reverse in another. A model trained on a calm period may fail in a volatile one.

Low signal-to-noise

Price changes are mostly noise. A model that predicts direction correctly 52% of the time may be useful, or may be luck. Tiny edges are hard to tell apart from chance and easily wiped out by costs.

Overfitting

Flexible models with many parameters can memorise past data. The more models and settings you try, the more likely the best one is a fluke. See avoiding overfitting.

Accuracy is not profit

A model that is right 60% of the time but loses more on wrong calls than it makes on right ones loses money. Evaluate models on the strategy's P&L after costs, not just on accuracy.

What machine learning can and cannot do

It can:

  • Find combinations of signals that simple rules miss.
  • Classify market conditions, such as trending or range-bound, to switch strategies on or off.
  • Improve execution, for example by predicting short-term liquidity.
  • Help size positions based on predicted volatility.

It cannot:

  • Predict prices reliably over long periods.
  • Remove the need for risk controls, stops and position limits.
  • Replace a clear reason for why a strategy should work.

Machine learning and SEBI's algo framework

Under SEBI's framework for retail algorithmic trading, which has applied in full since 1 April 2026, algorithms offered to retail investors through brokers are classified as white-box, where the logic is disclosed and can be replicated, or black-box, where it is not. Providers of black-box algorithms must be registered with SEBI as Research Analysts and maintain a research report for each algorithm. Many machine-learning strategies are hard to explain fully, so anyone planning to offer one to others should understand how it would be classified. Our guide to SEBI's algo trading rules covers the framework.

Getting started

If you want to explore machine learning for trading:

  1. Start with simple models and a clear question.
  2. Build a clean dataset with careful timestamps.
  3. Split by time and walk forward.
  4. Compare the model's strategy with a simple rule-based baseline.
  5. Paper trade any model before using real money.

QuantPower's strategy builder and backtesting engine focus on transparent, rule-based strategies, which are a good baseline to compare any model against. Our guide to systematic vs discretionary trading explains why transparent rules are easier to trust.

Start your free trial

Connect your broker, build a strategy and test it on paper before a single live order goes out.

Frequently asked questions

Can machine learning predict the stock market?

It can find weak patterns in some conditions, but market returns are mostly noise. Reliable long-term prediction is not realistic.

Which machine learning model is best for trading?

There is no single best model. Simple models are a good starting point; tree-based models often do well on tabular market data. Judge any model by out-of-sample strategy results after costs.

What is data leakage in trading models?

When information that would not have been available at prediction time slips into the model's inputs, making results look far better than they would be live.

Do I need coding skills for machine learning in trading?

Usually yes. Building and testing models properly requires programming, commonly in Python, and careful handling of data.

Sources

  • Gu, S., Kelly, B. and Xiu, D. (2020). Empirical Asset Pricing via Machine Learning. Review of Financial Studies, 33(5), 2223–2273
  • López de Prado, M. (2018). Advances in Financial Machine Learning. Wiley
  • SEBI circular: Safer participation of retail investors in algorithmic trading, 4 February 2025
Machine learning models can fail without warning when markets change. Trading involves substantial risk. This guide is for education and is not investment advice.