Concept
Label Definition & Prediction Horizon
Label Definition & Prediction Horizon is a Machine Learning concept.
What are Label Definition & Prediction Horizon?
In supervised machine learning for trading, the label is the target the model learns to predict, and the prediction horizon is how far into the future that target looks. Label definition converts raw future price action into a training signal: the sign of the forward return over the next N bars, whether price reaches a volatility-scaled target before a stop, or a three-way up/flat/down class beyond some threshold. Every scheme encodes an opinion about what counts as success, so two models trained on identical feature sets can behave completely differently purely because their labels differ.
The horizon ties the label to a trading style. A 5-bar horizon trains a scalping-tempo model, a 100-bar horizon trains a swing model, and mismatching horizon and intended holding period produces signals that fire on the wrong timescale. Very short horizons yield labels dominated by noise; very long horizons blur cause and effect and shrink the number of independent examples. And because labels are computed from data that had not printed yet, they exist only in hindsight: fine for training, but any live display of label-like values needs repaint-safe engineering to avoid showing information no trader could have had.
The standard schemes form a short menu. Fixed-horizon labeling takes the sign or size of the N-bar forward return; adding a deadband turns it into three classes so sub-cost wiggles train as flat rather than as spurious wins. Triple-barrier labeling tracks the path, recording whether a profit barrier, loss barrier, or time barrier is hit first, so a trade that would have been stopped out labels as a loss even if the endpoint recovered. Meta-labeling inverts the question: given a primary signal from any strategy, the label records whether that signal would have profited, and the model learns when to act and how much to size rather than which direction to pick.
Horizon choice also decides how much data you really have. Labels computed every bar over an N-bar horizon overlap: adjacent rows share almost all of their future window, so they are heavily correlated and a naive validation split leaks information across the boundary. Techniques from Marcos López de Prado's work, purging overlapping examples and embargoing a buffer after each test window, exist precisely to keep that leakage out of the score. On the Library side, Noldo's Dependent Variable Odd Generator is a chart-native example: it constructs candidate dependent variables on the chart so the labeling step is explicit rather than buried in a notebook.
How to identify a model's label and horizon
Whether you are building a model or auditing someone else's, the same questions expose what the label actually is.
- 1State the question precisely: direction, magnitude, or event, over how many bars, measured from which price (next open is honest, current close often is not).
- 2Match the horizon to the intended holding period and the market's session structure, converting bars to clock time so a 20-bar label means the same thing across timeframes.
- 3Set thresholds in volatility units rather than fixed percentages, so the flat class means the same thing in quiet and wild regimes.
- 4Decide whether the path matters: if a stop would have fired, endpoint labels lie, and a triple-barrier scheme is the truthful alternative.
- 5Check the overlap: labels sharing future bars are correlated, so purge and embargo around validation splits and treat the effective sample count as far smaller than the row count.
How traders use it
- Defining the target for a classifier: for example, label a bar +1 when the forward return over the horizon exceeds a volatility-scaled threshold, -1 below the negative threshold, and 0 otherwise, then train the model to predict that class from current features.
- Aligning model and strategy: the horizon is chosen to match the intended holding period and the threshold to clear realistic costs, so a bullish prediction corresponds to a tradeable move rather than a sub-spread wiggle.
- Auditing a learned signal: asking what was labeled, over what horizon, and how accuracy was measured on an out-of-sample split reveals what the model was actually optimized to do, which is often narrower than the description around it suggests.
- Meta-labeling an existing strategy: a second model is trained on labels recording when the primary signal won, and its output gates or sizes the trades, often passed through logistic signal calibration so the score behaves like a probability.
- Conditioning labels on regime: tagging training rows with a regime from Hidden Markov or Markov-switching models lets one model learn that the same setup means different things in trend and chop, or motivates training separate models per regime.
Label definition vs related modeling steps
Feature Engineering: Features describe the present; the label defines the future question. Leakage flows one way: a feature that peeks past the current bar poisons training, while a label must look forward by construction and must never be shown live.
Logistic Signal Calibration: Calibration happens after the label is fixed: it maps a model's raw scores onto honest probabilities of the labeled outcome. A miscalibrated model can be fixed downstream; a mis-posed label cannot, because every score answers the wrong question.
Ensemble Voting of Signals: Ensembles reduce variance around a shared question; they cannot repair an ill-posed one. If five models vote on a noise-dominated next-bar label, the ensemble is a more confident coin flip. Label design decides what every member is trying to predict.
Concept family
Machine Learning
32 concepts mapped · 32 in the Library
Label Definition & Prediction Horizon FAQ
Turn Label Definition & Prediction Horizon into a trading strategy.
Describe your Label Definition & Prediction Horizon idea to Quant. It builds the strategy with you and backtests it on real data.