Skip to content
All option guides
Build event-based labels from price paths13 min read

Triple-Barrier Method: Financial Event Labeling Explained

Learn how upper, lower, and time barriers create event-based labels, how volatility scales thresholds, and where data ambiguity and validation leakage can distort results.

In this guideWhy a first-touch label can answer a different question

Short summary

The triple-barrier method assigns an outcome to an event by asking which of three limits is reached first: an upper return threshold, a lower return threshold, or a maximum holding-time boundary. It is a way to define supervised-learning targets, not a trading strategy. The target scale, price path, expiry rule, and treatment of costs all need to be fixed before a model score can be interpreted.

Why a first-touch label can answer a different question

A fixed-horizon label asks what happened after a chosen number of bars. For example, it may classify the return five sessions after every daily observation. That is easy to describe, but the same horizon can end while one event is still moving and long after another has reached a meaningful gain or loss. It also ignores whether the price crossed a threshold before the end of the window.

Triple-barrier labeling instead gives each selected event two price limits and one time limit. The outcome ends at the first limit reached. That makes the sample duration variable: a fast move can resolve in one bar, while a quiet path can continue until the vertical barrier. López de Prado’s Chapter 3 on labeling presents the method alongside dynamic thresholds and meta-labeling; the Mlfin.py guide also describes upper, lower, and vertical barriers and volatility-scaled horizontal limits.

The distinction matters when defining y for a classifier. A label records an outcome under the chosen path and rules. It does not establish that the event was tradable at the displayed threshold, that another event will have the same distribution, or that the method identifies profitable entries.

Choose an event start and information set

An event starts at a decision time t₀ with reference price P₀. An event trigger decides which observations become events; it is separate from the barrier labeling that assigns their later outcomes. A CUSUM filter, for example, can select moments when cumulative price movement exceeds a threshold. It does not say whether the later path will reach an upper or lower barrier.

For each selected event, choose a target scale σᵢ that is available at t₀. It may be a volatility estimate or another predeclared measure of the move size being studied. The scale must use only information known by the event start. If the target is in fractional simple-return units, σᵢ = 0.02 means two percent. If the research instead uses log returns, calculate barrier prices in log-return space and keep that convention consistent throughout.

The barrier widths are decisions in the research design. A narrower profit threshold resolves some events earlier; a wider one requires a larger favorable move. A smaller stop width causes more lower-barrier touches, while a larger vertical horizon leaves more events open for longer. There is no universal multiplier pair: select values using a stated research question and training procedure, then evaluate them without tuning against the final test outcomes.

Define the upper, lower, and vertical barriers

Let mPT and mSL be nonnegative multipliers for the upper and lower return limits. In simple-return units, the upper threshold is +mPT × σᵢ and the lower threshold is −mSL × σᵢ. The corresponding reference prices are P₀ × (1 + mPTσᵢ) and P₀ × (1 − mSLσᵢ), respectively. This linear price form is for simple returns; a log-return design should convert the chosen log thresholds back to prices with exponentials.

The vertical barrier is an expiry time t₁ or a maximum holding period. It ends the search if neither horizontal threshold has been reached first. A complete event record should preserve its start time, target scale, both multipliers, vertical-barrier time, first-touch time, observed return, and final label. Recording these ingredients lets another researcher reconstruct why the label resolved.

For the primary directional convention used here, an upper first touch receives +1, a lower first touch receives −1, and expiry before either horizontal touch receives 0. The Mlfin.py documentation describes that three-class convention, and its current implementation explicitly returns 0 when the vertical barrier is the first boundary reached. Other implementations or research targets can assign the sign of the terminal return at expiry instead. Those choices are not interchangeable: state which rule applies, and use it consistently in metadata, code, and evaluation.

Work through three hypothetical paths

Suppose an event starts at P₀ = $100 and its known-at-start target scale is σᵢ = 2%. Choose mPT = 2 and mSL = 1.5. Under the simple-return convention, the upper price threshold is $100 × (1 + 2 × 0.02) = $104. The lower threshold is $100 × (1 − 1.5 × 0.02) = $97. Place the vertical barrier after the third future bar.

Observed future pathFirst boundary reachedLabel under this article’s rule
$100 → $104.50 on the first future barUpper threshold, before expiry+1
$100 → $96.50 on the first future barLower threshold, before expiry−1
$100 → $101 → $102 → $101.50 at the third barVertical expiry; neither horizontal threshold touched0

The vertical barrier is reached at the end of the third future bar. The first two paths cross a horizontal boundary during the first future bar, so neither outcome ties with expiry. The third path ends $1.50 above its starting price, yet receives 0 under the stated first-touch convention. That is not a calculation error: this label records that neither horizontal boundary was crossed before the maximum holding time. A terminal-sign convention would produce a different target for the same path. The example uses invented prices to explain the rule; it is not a market observation or evidence of likely returns.

The target scale and multipliers describe a boundary, not a guaranteed fill. If the next observed price gaps from $100 to $105, a bar-based record may show that the upper threshold was crossed, while a real order could fill at a different price after the gap. A label of +1 therefore means “upper barrier first” under the data and execution convention, not “earned exactly the threshold return.”

Three unlabeled price paths: one crosses the upper boundary, one the lower boundary, and one ends between them at a time limit
Conceptual paths show the first touch of an upper, lower, or time boundary; they are illustrative, not market data

Decide how the observed price path resolves a touch

A close-only series can miss an intrabar crossing. A bar might open at $100, trade above $104, and close at $103; a close-based search would not see the upper touch even though the high did. Using high and low fields improves touch detection but creates another problem: if one bar’s high is above the upper barrier and its low is below the lower barrier, OHLC data alone does not reveal which was reached first.

There is no defensible way to recover an unknown intrabar order from only the bar’s open, high, low, and close. Use finer timestamped trades or quotes when available. If the data cannot identify the order, state a deterministic conservative rule before comparing outcomes, apply it to every event, and report how many labels it affects. Do not choose whichever boundary makes the strategy look best after seeing the result.

The same discipline applies to market sessions, missing bars, and gaps. Define whether the price used to establish P₀ is an executable open, a close known before the decision, or another field. Define how an event that starts near a market close finds its vertical expiry, how absent prices are handled, and whether a jump through a barrier is recorded at the threshold or the first available price. These choices affect the label and can differ across assets and feeds.

Keep primary labels and meta-labels distinct

With no prior side prediction, the primary label can describe direction: +1 for an upper first touch, −1 for a lower first touch, and 0 for a timeout under this article’s rule. A model trained on these labels is being asked to classify those event outcomes. The selected class balance depends on event selection, barriers, data resolution, and the market period.

Meta-labeling answers a different question. A primary model or other rule proposes long or short; a secondary model then estimates whether to take that proposed side, or can inform its size. The secondary target is built from the outcome relative to the proposed side, so a raw upward move is not automatically a correct signal when the proposed side was short. The common binary take/pass setup uses labels such as 1 for a favorable side-adjusted outcome and 0 for a pass, but expiry and cost rules still need to be declared. Chapter 3 of *Advances in Financial Machine Learning* separates learning side and size from the initial directional labeling.

Do not compare primary and meta-label scores as if they measured the same task. Keep the primary side, secondary decision, side-adjusted return, event endpoint, and final position size in separate fields. If labels represent gross price movement, account separately for spread, commissions, market impact, funding, borrow, and other costs before claiming that the proposed side would have been usable.

Prevent future information and overlapping outcomes from leaking

Build each feature row from the information available at its event start. This includes the target scale σᵢ, normalization parameters, event trigger inputs, and any proposed side. A volatility series calculated over the full sample, centered rolling window, or later-revised field can leak future information even when the label formula itself is correct. Future prices belong in the outcome calculation y, not in predictors available at t₀.

Events may overlap. A new event can start before an earlier one reaches a barrier, so their forward paths may share bars. If one overlapping event lands in training and another in validation, the validation outcome is not fully independent of the training outcomes. Save each event’s actual start and resolution time; purge training events whose label intervals overlap the validation interval. Then choose a chronological or purged validation design that answers the intended question. See purged cross-validation and embargo and backtest-overfitting diagnostics for related safeguards.

Purging overlap does not turn every split into a historical deployment replay. A purged K-fold procedure may still train on events that occur after a validation fold. If the claim is what could have been known at a historical date, use a time-ordered evaluation and fit all preprocessing and tuning steps inside the training history. Report the event definition, overlap rule, split dates, and any embargo separately.

Evaluate the label as a research choice

Barrier labeling can make targets reflect risk-scaled moves and variable event durations, but it does not make a predictive problem easy or a sample representative. Changing mPT, mSL, σᵢ, the vertical horizon, event filter, bar frequency, or timeout convention changes which events resolve and what the classes mean. Comparing models trained on different label definitions without explaining those differences can turn a modeling comparison into a comparison of targets.

Before interpreting a metric, report class frequencies, event duration, returns at resolution, costs, and results by time period and instrument. Check how often both horizontal limits fall inside the same OHLC bar, how often a price gaps through a boundary, and how missing observations alter endpoints. If the model’s decision would create a position, estimate fills, spread, fees, funding or borrow where applicable, and market impact using information and execution assumptions available at the time.

Keep a reproducible label specification with event timestamps, price field, return convention, target-scale estimator and lookback, profit and stop multipliers, time limit, first-touch tie rule, expiry label, side-prediction source, and cost treatment. A strong classification score under that specification is evidence about that dataset and design; it is not a forecast guarantee, a recommendation, or proof of trading profitability.

Common questions

Q1Does a triple-barrier label prove that an order could have filled at the boundary?

No. A label describes the first threshold reached under the chosen price data and rule. Gaps, spread, queue position, and market impact can make an executable fill differ from the threshold.

Q2Is a timeout always labeled zero?

No. Zero is the convention used in this guide and in the cited Mlfin.py implementation for a vertical first touch. Another target can use the terminal return sign or a separate timeout class. Record the definition before training.

Q3Does meta-labeling find the market direction?

Not by itself. A primary signal supplies a side; a secondary model assesses whether to take that side or how much to size. Its target and evaluation should reflect the proposed side and the declared cost assumptions.

Sources and further reading

Report an issue

We’ll prepare an email with this article link. Mark receives the report only after you send it

Quick check

Read the guide? Check yourself with 3 questions

Question 1 / 3

Question 01

An event’s upper and lower return barriers are both untouched when its vertical time limit arrives. What label does this guide assign?

Choose an answer to see the explanation

Options glossary