Level 3 AI in trading · Part 4/8

Labels: Triple Barrier and Meta-Labeling

The question a model is meant to answer is usually settled in two lines of code and then never revisited. It is the most consequential decision in the whole pipeline.

Why the fixed horizon fails

The standard approach asks: “is price higher in ten periods?” It has a flaw that invalidates every later evaluation – it ignores the path.

Two paths with identical labels:

To the model both are wins. In practice B is a loss, because any sensible risk management would have stopped out long before. A model trained on such labels learns to prefer situations that cannot actually be held.

The triple-barrier method

1234alysly.com
Instead of asking "is price higher in 10 days?", the triple-barrier method asks which of three limits is touched first: (1) the upper profit threshold, (2) the lower loss threshold, (3) the vertical time limit. (4) Here the upper barrier is hit first — the label is +1. The difference from a fixed horizon matters: a path that plunges in between and then recovers gets a loss label here and a win label there. Only the first is tradable.

Instead of asking after a fixed horizon, three limits are set and the question is which is touched first:

  1. an upper limit (profit target),
  2. a lower limit (loss limit),
  3. a vertical limit (maximum holding time).

The label follows from whichever is touched first: +1, −1 or 0. It therefore reproduces exactly what would have happened to a real position.

One important addition: the barriers are set relative to volatility, for instance as a multiple of current ATR . Fixed percentage barriers otherwise produce almost only time-limit labels in quiet phases and almost only hits in volatile ones – the model then mainly learns the volatility regime.

Meta-labeling

A second idea that decomposes the problem differently.

+1 / −110 / 120 … 13alysly.com
Meta-labeling splits one hard question into two easier ones: (1) a primary model — or a plain rule — decides direction only (+1 or −1). (2) A secondary model judges solely whether that signal is likely correct (0 or 1). (3) Its probability becomes the position size between 0 and 1. The benefit: the secondary model learns a cleanly defined binary task and may set size to zero without ever second-guessing direction.

A primary model – or a plain rule, such as a crossover from Level 2 – determines direction only. A secondary model then answers a single binary question: is this signal likely correct? Its probability becomes the position size, between zero and full.

The benefit is in the division of labour:

In practice meta-labeling usually does not improve the hit rate but the ratio of win to loss – it filters out the weak signals. In the language of Level 1 : it raises expectancy per trade, not the number of winners.

The side effect

Both methods create a problem covered in the next article: when a label runs until a barrier is touched, neighbouring examples overlap. Two observations one period apart share almost their entire outcome window – and are therefore anything but independent.

Next

Exactly that overlap, and how sample weights handle it.