Advanced Meta-Labeling
Meta-labeling is a powerful quantitative technique pioneered by Dr. Marcos Lopez de Prado. It addresses a fundamental flaw in traditional machine learning: the attempt to predict price direction directly. Instead, Meta-labeling assumes you already have a "Primary Model" (your trading strategy) and uses a "Secondary Model" (Machine Learning) to predict the validity of that strategy's signals.
In the AlgoLift ecosystem, this allows you to keep your core trading logic simple while using AI to handle the complex task of risk filtering.
The Binary Classification Task
In Meta-labeling, the ML model isn't asking "Will price go up?" It is asking "Given the current market context, is the signal generated by my SMA Crossover likely to hit its profit target before its stop loss?" The output is a probability score between 0 and 1.
Primary vs. Secondary Models
Professional meta-labeling requires two distinct layers of logic:
- The Primary Model: This is your "Base Strategy" (e.g., a Mean Reversion system). It determines the side of the trade (Long or Short) and the entry price. It is designed to have high Recall—it captures as many potential opportunities as possible.
- The Secondary Model (The Meta-Labeler): This is the ML layer. It looks at market "Features" (Volatility, Volume, Spread) at the time of the primary signal and decides if the signal should be taken. Its goal is to maximize Precision—ensuring that when we do trade, the probability of success is maximized.
The Triple Barrier Method
To train a meta-labeler, AlgoLift utilizes the Triple Barrier Method. This is a more realistic labeling system than standard "Fixed Horizon" labels.
A trade is labeled based on which of three barriers is hit first:
- Upper Barrier (Profit): Success (Label 1).
- Lower Barrier (Stop): Failure (Label 0).
- Vertical Barrier (Time): If neither is hit within N bars, the trade is closed and labeled based on its current P&L.
By training on these realistic outcomes, the ML model learns to recognize the market structures that lead to "Target Reached" vs. "Stopped Out."
Under the Hood: Feature Importance
AlgoLift's meta-labeling engine allows you to audit Feature Importance. You can see if the model is primarily using Volatility (ATR), Trend Strength (ADX), or Time-of-Day to make its decisions. If a model relies too heavily on a single "noisy" feature, you can prune it to improve generalization.
Combatting Alpha Decay
All strategies suffer from "Alpha Decay" as market participants adapt to the same patterns. Meta-labeling provides a buffer against this. While your primary logic might remain static, you can periodically re-train the secondary ML model on recent data.
This allows the system to learn that a specific setup which worked in 2022 might now require a higher volatility environment to be successful in 2024.
Probability Calibration
The output of a Meta-labeler is a probability. AlgoLift includes a Calibration Layer that ensures these probabilities are "True."
If the model gives a trade a 70% confidence score, a calibrated model ensures that, historically, 70% of those specific setups resulted in a win. This allows you to set a "Probability Threshold"—for example, only taking trades where the AI is at least 65% confident.
Pro Tip: The Size-Confidant Link
Advanced traders use Meta-labeling for Dynamic Position Sizing. Instead of just "On/Off," you can link your position size to the ML confidence score. A 55% confident signal gets a small position, while an 85% "A+ Setup" gets a maximum risk allocation.