Concept
Decision Trees
Decision Trees are Machine Learning concepts. The Library holds 1 implementation, a working definition you can pull into Quant.
Top Decision Trees indicator
The top custom implementation, built on the original standard Decision Trees formula.
1 total
The Decision Trees implementation below can become a backtested trading strategy — describe your rules and Quant writes the code.
What are decision trees?
A decision tree predicts by asking a sequence of yes/no questions about the input features, such as whether RSI is below 30 or whether relative volume exceeds 1.5, and routing each observation down branches until it reaches a leaf that stores a prediction: a class label, a probability, or a numeric value. Training grows the tree greedily, choosing at each node the feature and threshold that best separate the outcomes, and recursing until a stopping rule such as maximum depth or minimum leaf size is hit. The CART formulation by Breiman, Friedman, Olshen, and Stone (1984) is the basis of most modern implementations.
Trees appeal to traders for two reasons. They are readable: a fitted tree is literally a set of if-then rules, close in spirit to how discretionary checklists are written, so a model's logic can be audited line by line. And they are undemanding: no feature scaling, native handling of nonlinear thresholds and feature interactions, and tolerance for mixed input types. The weakness is instability. A single deep tree fits noise aggressively, and small changes in training data can produce a structurally different tree, which is why standalone trees are mostly a teaching device and a building block. Ensembles such as random forests and gradient boosting exist largely to fix the single tree's variance problem.
How it's calculated
Each split is chosen to maximize the reduction in an impurity measure. For classification the common measures are Gini impurity and entropy; for regression, variance.
The tree grows by repeatedly taking the split with the highest gain, then pruning or depth limits control overfitting.
Gini and entropy usually produce similar trees; the choice rarely matters as much as depth and leaf-size limits.
How traders use it
- Rule extraction: a shallow tree (depth 2 to 4) fitted to labeled bars yields a handful of explicit conditions, effectively an automated setup screener whose rules a human can veto or refine.
- As the base learner in ensembles: in practice most tree value in trading comes through forests and boosted models, where hundreds of constrained trees are combined and the single tree's instability is averaged away.
- Regime splitting: a tree trained to predict volatility or trend state produces interpretable thresholds, such as a specific reading on a volatility measure, that can gate other strategies.
- Feature triage: even when the final model is different, the features a tree splits on early are candidates worth keeping during feature selection.
- Knowing the limits: trees predict constants within regions, cannot extrapolate beyond training ranges, and a deep tree on noisy returns will fit that noise, so raw price levels as features fail quietly at new highs.
Decision trees vs. tree ensembles
Random Forest: A forest averages many randomized trees, trading the single tree's readability for far lower variance. If interpretability is the goal, use one shallow tree; if accuracy is the goal, the ensemble usually wins.
Gradient Boosting: Boosting grows small trees sequentially, each correcting the last, and typically outperforms both a single tree and a forest on tabular data when tuned, at the cost of more sensitivity to noise and hyperparameters.
Concept family
Machine Learning
32 concepts mapped · 32 in the Library
Decision Trees FAQ
Turn Decision Trees into a trading strategy.
Take the implementation from this page into Quant, then build on it, backtest it on real data, and keep refining it in conversation.
