Binary Classifier
systemic:core-bclsMachine learningInputs
| Name | Type | Description |
|---|---|---|
| N Estimators | Whole number | The number of weak learners (decision trees) in the AdaBoost ensemble. |
| Decision Tree Max Depth | Whole number | The maximum depth of each decision tree in the ensemble. |
| Random State | Whole number | The seed for the random number generator, which makes the model reproducible. |
| Feature matrix | Several number series | The feature series the model learns from: 1 to 10 series, each with one value per bar. |
| Target labels | Whole number series | The class label (0 or 1) the model learns to predict, one per bar. |
Outputs
| Name | Type | Description |
|---|---|---|
| Feature Importances | Several number series | A matrix with one row per bar and one column per feature: how much each feature weighs in the model used on that bar. |
| Prediction | Whole number series | The predicted class (0 or 1) for each bar. |
| Prediction Confidence | Number series | The probability the model gives to its predicted class on each bar, from 0 to 1. |
Cost
0.194 + 0.0518·n + 0.000000546·n² credits for n bars, rounded up. The marks are each plan's limit of bars.
The Binary Classifier module adds machine learning to your strategy with an ensemble method called AdaBoost (Adaptive Boosting). It learns patterns from historical data to predict a yes/no outcome, such as "price goes up" or "price goes down". It returns a prediction and a confidence score.
How AdaBoost Works
AdaBoost is an ensemble learning algorithm that combines many "weak learners" (simple models that are only slightly better than random guessing) into one "strong learner."
flowchart TD
subgraph Training["Training Phase"]
D1["Weak Learner 1<br/>(Decision Stump)"]
D2["Weak Learner 2<br/>(Corrects #1's errors)"]
D3["Weak Learner 3<br/>(Corrects #2's errors)"]
DN["... N Learners"]
end
subgraph Ensemble["Final Ensemble"]
V["Weighted Vote<br/>of All Learners"]
end
D1 --> D2 --> D3 --> DN --> V
V --> P["Prediction: 0 or 1"]
V --> C["Confidence: 0.0 to 1.0"]
The AdaBoost Process
- Start with equal weights for all training samples
- Train a weak learner (decision stump—a tree with just one split)
- Identify misclassified samples and increase their weights
- Train the next weak learner focusing on the harder samples
- Repeat for N estimators
- Combine all learners with weighted voting based on their accuracy
This iterative focus on difficult cases is what gives AdaBoost its name—it adapts to the hardest examples.
Mathematical Foundation
Decision Stump
A decision stump is a one-level decision tree that makes a single binary split:
Where is a single feature and is the optimal threshold.
AdaBoost Weighting
After each round , sample weights are updated:
Where:
- is the learner's weight (based on its accuracy)
- is the true label
- is the learner's prediction
Misclassified samples get higher weights, focusing subsequent learners on the hard cases.
Final Prediction
The ensemble combines all learners:
Training and Prediction Flow
flowchart LR
subgraph Inputs["Feature Matrix"]
F1["Feature 1<br/>(e.g., RSI)"]
F2["Feature 2<br/>(e.g., MACD)"]
F3["Feature 3<br/>(e.g., Volume)"]
end
subgraph Labels["Target Labels"]
T["Historical Outcomes<br/>(0 or 1)"]
end
subgraph Model["Walk-Forward AdaBoost"]
TR["Retrain every 50<br/>new samples"]
end
subgraph Outputs["Predictions"]
P["Per-Sample<br/>Prediction Series"]
C["Per-Sample<br/>Confidence Series"]
FI["Per-Sample<br/>Importance Matrix"]
end
F1 & F2 & F3 --> TR
T --> TR
TR --> P & C & FI
Key Behavior: BCLS walks forward one sample (bar) at a time. The values of
prediction,confidenceandfeature_importanceon a bar always come from a model trained only on samples before that bar. This prevents look-ahead bias on every bar, not just the last one. The model is retrained each time 50 new complete, labeled samples are available. Bars in between are predicted with the latest model.
Missing Data
- A sample with any empty feature cannot be predicted:
prediction,confidenceandfeature_importanceare all empty on that bar, and the sample is left out of training. - An empty target label only affects training. The sample it belongs to can still be predicted if its features are complete.
- Mixed calendars (for example, a 24/7 crypto feature next to a business-day feature): weekend and holiday bars are left out of training, so the model does not learn from the crypto feature's weekend values. A matrix built only from business-day series loses nothing.
- The outputs are empty on the first bars, until at least 2 complete, labeled samples exist before the bar being predicted.
feature_importanceis for charts only. It is a matrix (one row per bar) and cannot be wired into another module as a series.
Outputs Explained
| Output | Description | Range |
|---|---|---|
| Prediction | The predicted class (0 or 1) for each sample | {0, 1} |
| Prediction Confidence | Probability assigned to the predicted class | [0.0, 1.0] |
| Feature Importances | How much each feature contributed to decisions | [0.0, 1.0] per feature |
Interpreting Confidence
- Confidence = 0.95: The model gives its prediction a 95% probability—high conviction
- Confidence = 0.52: Nearly 50/50—the model is uncertain, treat with caution
- Confidence thresholds: Many traders only act when confidence exceeds 0.6 or 0.7
Understanding Feature Importance
Feature importance reveals which inputs drive the model's decisions:
pie title Feature Importance Example
"RSI" : 45
"MACD Histogram" : 30
"Volume Delta" : 15
"Price ROC" : 10
Use this to:
- Validate your intuition — Are the "right" features being weighted?
- Simplify your system — Remove low-importance features to reduce noise
- Discover patterns — Sometimes unexpected features dominate
Practical Applications in Trading
1. Trend Direction Prediction
Train the classifier to predict whether price will be higher or lower N bars ahead:
| Feature Inputs | Target Label |
|---|---|
| RSI, MACD, OBV, ATR | 1 if Close[t+5] > Close[t], else 0 |
2. Regime Classification
Classify market conditions to select appropriate strategies:
| Feature Inputs | Target Label |
|---|---|
| ADX, Volatility, Correlation | 1 = Trending, 0 = Range-bound |
3. Signal Filtering
Use the classifier to filter signals from other indicators:
flowchart TD
Signal["Raw Buy Signal<br/>(e.g., Golden Cross)"]
BCLS["Binary Classifier"]
Confidence{"Confidence > 0.65?"}
Execute["Keep Signal"]
Skip["Drop Signal"]
Signal --> BCLS
BCLS --> Confidence
Confidence -->|Yes| Execute
Confidence -->|No| Skip
Configuration Parameters
| Parameter | Description | Typical Value |
|---|---|---|
| N Estimators | Number of weak learners to combine | 50–200 |
| Decision Tree Max Depth | Depth of each decision tree (1 = stump) | 1–3 |
| Random State | Seed for reproducibility | Any whole number from 1 |
Parameter Guidance
- More estimators generally improve accuracy but take longer to compute
- Deeper trees can capture more complex patterns but risk overfitting
- Decision stumps (depth=1) are the classic AdaBoost configuration and work well for noisy financial data
Advantages
- Resistant to overfitting — Simple weak learners are less likely to memorize noise
- Handles complex patterns — Ensemble captures non-linear relationships
- Interpretable — Feature importance reveals what drives predictions
- Adaptable — Works with any numerical features you can compute
Limitations
- Requires labeled data — You must define and provide historical target labels
- Sensitive to outliers — Extreme samples can dominate training
- No guarantee of future performance — Past patterns may not repeat
- Black box to some degree — While feature importance helps, exact decision logic is complex
Further Reading
- AdaBoost - Wikipedia
- Ensemble Methods in Machine Learning
- Machine Learning for Trading - Georgia Tech
Indicator Assessment
---
config:
xyChart:
width: 600
height: 400
themeVariables:
xyChart:
plotColorPalette: "#1abc9c, #e74c3c"
---
xychart-beta horizontal
title "Binary Classifier Assessment (Scale: 1-10)"
x-axis ["Popularity", "Reliability", "Complexity", "Versatility", "Recent Interest"]
y-axis "Score" 0 --> 10
bar [5, 5, 7, 8, 8]
bar [4, 4, 7, 8, 9]
Legend: First bar (teal) = Equities/Forex | Second bar (red) = Cryptocurrency
Dimension Explanations
| Dimension | Equities/Forex | Crypto | Rationale |
|---|---|---|---|
| Popularity | 5 | 4 | Machine learning classifiers are less common than traditional indicators. Growing adoption among quant traders. Less established in crypto retail trading. |
| Reliability | 5 | 4 | Performance depends heavily on feature selection and market regime. Risk of overfitting. Requires careful validation. Markets may shift, invalidating learned patterns. |
| Complexity | 7 | 7 | Requires understanding of machine learning concepts, feature engineering, and proper train/test splits. Not beginner-friendly. |
| Versatility | 8 | 8 | Can be applied to any binary classification problem: trend direction, regime detection, signal filtering. Highly adaptable with different feature sets. |
| Recent Interest | 8 | 9 | Strong growth in ML-based trading research. Increasing integration in trading platforms. Very high interest in crypto algorithmic trading communities. |