← All experiments

Experiment 002 · Machine learning

Can XGBoost Predict Tomorrow?

Four possible directions, fourteen signals, ten stocks, and one deliberately skeptical test of whether yesterday contains a useful hint about the next trading day.

Data through loading… · refreshed

Held-out results

How much signal did it find?

The model never sees these final dates during training. Higher is better, but modest scores are the honest expectation for noisy daily markets.

Exact four-way categoryDirection onlyFour-way chance: 25%

Latest reading

What it predicts next

Probabilities are the model’s relative confidence—not a promise, recommendation, or calibrated chance of profit.

first, define the question

Four ways tomorrow can go

Rather than guess an exact price, the model classifies the next adjusted-close return. There is no universal industry standard for these labels, so this experiment uses a simple symmetric 1% boundary that is easy to interpret and keeps “direction” separate from “magnitude.”

Very negativebelow −1%
Negative−1% to 0%
Positive0% to +1%
Very positive+1% or more

Where it succeeds—and slips

Read the mistakes, not just the score

Balanced accuracy gives each class equal weight. The confusion matrix shows which classes the model tends to confuse.

Confusion matrix

Rows are what happened; columns are what the model predicted.

Accuracy by stock

Exact four-way accuracy and simpler up-or-down accuracy.

Fourteen clues

What the model actually reads

A compact set spanning momentum, trend, volatility, volume, and market context. Importance is measured on held-out data by shuffling one signal at a time.

01

Momentum

Returns over 1, 5, 21, and 63 trading days, plus 14-day RSI and relative strength against the S&P 500.

02

Trend

Distance from 20- and 50-day moving averages and the gap between 12- and 26-day exponential averages.

03

Risk + participation

Recent volatility, drawdown, average true range, unusual volume, and the market’s own weekly return.

xgboost in a nutshell

A committee that learns from its misses

XGBoost builds many shallow decision trees in sequence. Each new tree focuses on patterns the earlier trees handled poorly; their weighted votes become probabilities for the four return classes. Here, 260 depth-three trees keep each individual rule modest.

prediction
Fk(x)=m=1260η·fm,k(x) P(y=k|x)=eFk(x)j=14eFj(x)

Each tree adds a small class-specific correction, scaled by learning rate η = 0.04. Softmax turns the four accumulated scores into probabilities.

the honest setup

How the test works

  1. 01

    Pool the ten stocks

    Each stock-day becomes one example. Stock identity is included, while the same signal definitions apply to every company.

  2. 02

    Split forward in time

    The earliest 80% of dates train the evaluation model; the newest 20% form one untouched chronological test. Future observations never leak backward.

  3. 03

    Balance the classes

    Training examples are weighted so rare large moves matter. The headline balanced accuracy is the mean recall across all four labels.

  4. 04

    Refit for tomorrow

    After scoring the untouched test, a separate live model refits on every labeled date. The daily workflow publishes its new next-day reading after market data updates.

Notes & sources

The signal families follow commonly used technical-analysis concepts described by Fidelity’s technical-analysis guide ↗. Model implementation uses XGBoost’s scikit-learn classifier ↗. The evaluation uses scikit-learn balanced accuracy ↗ and held-out permutation importance ↗.