Our partnerSkilling
  • Spreads from 0.1 pips
  • 1,000+ instruments
  • Free demo account

65% of retail investor accounts lose money when trading CFDs with this provider.

SkillingOpen account
Module 4 · Machine learning in trading

4.1 How a machine learns

Lesson 15 of 26Reading time: 2 minFact-checked

Machine learning means the computer learns from examples. The basic idea is simple.

Three ingredients

PartExplanationTrading example
FeaturesThe information the model is givenRSI, distance to the moving average, volume, weekday
LabelWhat the model has to learn to predictDid the price rise over the next five days? Yes or no
TrainingThe model adjusts itself to hit the label as well as possibleThousands of historical examples

After training, the model can give an estimate for new situations: “In situations like this one, the price rose 54% of the time.”

Common types of model

  • Linear regression: Simple and easy to understand.
  • Decision trees and “random forests”: Many yes/no questions. Popular in finance.
  • Neural networks: Powerful, but they need a lot of data and are easily overfitted.

54% is not 100%

Even a good model only gives probabilities – and often only slightly better than a coin toss. In trading that can be enough, but only if the profits are large enough to cover the costs and the risk is well managed.

Want to try it yourself?

With Python and free libraries such as scikit-learn you can build a simple model in an afternoon – and a language model can write the code for you. Use it as a learning exercise, not as a money machine.

From the textbooks: three ways to fit the same data

Too simple, about right or overfittedToo simpleMisses the patternAbout rightHas learned the patternOverfittedHas learned the noise
The same points, three models. Only the middle one has learned the pattern and not the noise.

Every textbook on machine learning makes the same point with a picture like this. A model that is too simple misses the pattern. A model that is too flexible memorises every wobble in the data, including the random ones, and fails on anything new. Financial data is mostly noise. In trading, the danger is therefore almost always on the flexible side.

Key takeaways

  • Machine learning consists of features, labels and training on historical examples.
  • The model gives probabilities – often only slightly better than a coin toss.
  • Simple models are easier to understand and are less often overfitted.
Practise what you have learned – without riskTry it on a free demo account with Skilling, with real prices and virtual money.
Open a free demo account

65% of retail investor accounts lose money when trading CFDs with this provider.