# Gradient Boosting

Gradient Boosting is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Trains a walk-forward boosted-trees ensemble on five stationary chart features and plots its prediction as an oscillator: P(up) around a 50 line under log loss by default, or expected forward percent return around zero in regression mode. Early stopping, subsampling and L2 regularization are built in, with a model card reporting validation loss and two feature-importance reads.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Jun 16, 2026.
- Access: free.
- Concepts: [Gradient Boosting](https://www.luxalgo.com/library/concept/gradient-boosting/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=zwttp4s8wsv3e4p2a0u0z448
- Page: https://www.luxalgo.com/library/indicator/gradient-boosting/

**Gradient Boosting** fits a stagewise ensemble of shallow trees and plots its prediction as an oscillator, the first faithful implementation of [gradient boosting](https://www.luxalgo.com/library/concept/gradient-boosting/) in the library. Five stationary features are labeled by the percent change of close over the next 10 bars; the model refits every 100 bars on the latest 300 samples, early-stopped on a later-in-time validation slice, and the Prediction line runs against a Center line with dashed thresholds.

## How to Trade the Gradient Boosting?

- **Prediction crosses the Center**: the ensemble's lean over the horizon flips, with alerts both ways.
- **Threshold crosses**: P(up) beyond the Probability Threshold % (or below 100 minus it) fires the high-confidence alerts, the classic signal-filtering gate.
- **Model card**: trees kept versus grown, validation loss, base rate and two importance reads. Trust permutation, computed on held-out data, over gain.

A Model Retrained alert fires on every refit.

## Gradient Boosting Settings

- **Loss / Target** (default Log Loss (Classification)): classifier plotting P(up), or squared-error regressor plotting expected forward return.
- **Prediction Horizon (bars)** (default 10), **Training Window (samples)** (default 300), **Validation Fraction** (default 0.25) and **Retrain Every (bars)** (default 100): labeling and walk-forward cadence.
- **Max Boosting Rounds (M)** (default 40), **Learning Rate (eta)** (default 0.05), **Max Tree Depth** (default 2) and **Early Stopping Patience** (default 10): the ensemble's size and pace; leaf, L2, subsample, split-candidate and seed inputs regularize and reproduce the fit.
- **RSI Length** (default 14), **Trend Z-Score Length** (default 20), **Momentum ROC Length** (default 10), **ATR Length** (default 14), **Range Position Length** (default 20) and **Normalization Window** (default 100): the feature lookbacks.
- **Probability Threshold %** (default 60): the alert gate; display toggles round out the inputs.

## Frequently Asked Questions

### How does this differ from the Random Forest build?

A [Random Forest](https://www.luxalgo.com/library/indicator/random-forest/) averages independent trees to cancel variance; boosting grows them one at a time, each targeting what the ensemble still gets wrong. Sharper but noise-hungry, hence the built-in shrinkage, subsampling and early stopping.

### Does the model peek at future bars?

No. Samples are added on closed bars only, labels wait for their full horizon, and validation is always later in time than training.

### Which settings should I touch first?

The horizon and window define the question; settle those before tuning the engine. Deeper trees and more rounds chase label noise. The shallow, low-eta defaults follow the practitioner norm.

## Related indicators

- [Nadaraya-Watson Envelope](https://www.luxalgo.com/library/indicator/nadaraya-watson-envelope/) (Kernel Regression): markdown at https://www.luxalgo.com/library/indicator/nadaraya-watson-envelope.md
- [Nadaraya-Watson Smoothers](https://www.luxalgo.com/library/indicator/nadaraya-watson-smoothers/) (Kernel Regression): markdown at https://www.luxalgo.com/library/indicator/nadaraya-watson-smoothers.md
- [Gaussian Volume Profile](https://www.luxalgo.com/library/indicator/gaussian-volume-profile/) (Kernel Density Estimation): markdown at https://www.luxalgo.com/library/indicator/gaussian-volume-profile.md
- [KDE Value Clouds](https://www.luxalgo.com/library/indicator/kde-value-clouds/) (Kernel Density Estimation): markdown at https://www.luxalgo.com/library/indicator/kde-value-clouds.md
- [Structural SVM Ranker](https://www.luxalgo.com/library/indicator/structural-svm-ranker/) (Support Vector Machines): markdown at https://www.luxalgo.com/library/indicator/structural-svm-ranker.md
- [Machine Learning: Gaussian Process Regression](https://www.luxalgo.com/library/indicator/machine-learning-gaussian-process-regression/) (Kernel Regression): markdown at https://www.luxalgo.com/library/indicator/machine-learning-gaussian-process-regression.md
- [Decision Trees](https://www.luxalgo.com/library/indicator/decision-trees/) (Machine Learning): markdown at https://www.luxalgo.com/library/indicator/decision-trees.md
- [Machine Learning: Anchored Gaussian Process Regression](https://www.luxalgo.com/library/indicator/machine-learning-anchored-gaussian-process-regression/) (Kernel Regression): markdown at https://www.luxalgo.com/library/indicator/machine-learning-anchored-gaussian-process-regression.md

---

Source: https://www.luxalgo.com/library/indicator/gradient-boosting/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
