A trade path between a stop-loss and a profit target with a vertical time barrier deciding the result.
The label is the trade outcome, not a vague forecast of where price might drift.

The three barriers

The idea is blunt. Enter a trade, then ask which comes first: the stop-loss, the profit target, or the vertical time barrier. The first barrier hit decides the outcome. That turns a noisy price series into a trade outcome measured in risk multiples.

  • Stop-loss. The trade failed before the upside showed up.
  • Profit target. The move paid quickly enough to count.
  • Vertical barrier. Time ran out before either side won.

Why it is better than a raw return label

A future return target is too soft. It ignores whether the move was tradable after a stop, how long the capital was trapped, and whether the idea was supposed to be directional or merely predictive. Triple-barrier labels bake in the trade rules first and the prediction second.

That matters because the model stops learning abstract price drift and starts learning something closer to a decision: is this setup worth putting money behind, given the stop, target, and time budget?

What Quantfoo does with it

Quantfoo simulates the trade from each bar, enters at the next open, and measures the outcome in R. The target already includes the execution assumptions from the panel: stop distance, reward/risk ratio, and max trade duration. That makes the label honest about the rules you actually set.

Common mistakes

The usual failure mode is simple. People tune the barrier sizes until the label looks easy to predict. That is not insight. That is target engineering for a backtest. If the result only works because the target was softened, the model did not become better.

A worked example

Say a trade enters at 100 with a stop at 96, a target at 106, and a 10-bar timeout. If price hits 106 on bar 4, the label is a target win. If it hits 96 first, the label is a stop. If neither happens before bar 10, the timeout decides the outcome.

That framing is useful because the label now matches the trade rule, not a generic future return.

Edge cases

  • Both barriers touch intrabar. You need a rule for which event counts first.
  • Gaps over the stop. The fill can be worse than the nominal barrier.
  • Very wide barriers. The label becomes mostly a timeout, which weakens the target.