← Back to AI Prediction

AI4FINANCE LAB · AI PREDICTION · MODEL INPUT

What the LSTM reads before it forecasts

Each forecast starts from a table of 15 trading days × 8 numbers, built only from the stock's own price and volume history. No news and no sentiment goes in.

1 · RAW DATA
Daily prices
Open, high, low, close and volume for each trading day, adjusted for splits and dividends.
→
2 · FEATURES
8 numbers per day
Trend, momentum, volatility and volume, each using only data known on that day.
→
3 · WINDOW
Last 15 days
The 15 most recent rows are stacked into one 15 × 8 table, oldest first.
→
4 · LSTM
Reads it row by row
A small network (16 memory units) carries a memory from day to day.
→
5 · OUTPUT
2 numbers
The expected move over 1 day and over 5 days, scaled back by the stock's volatility.
The input vector: 15 days × 8 features
Colours are illustrative values: green above normal, red below normal.
1-day
return
5-day
return
price vs
20-day avg
20- vs
50-day avg
RSI
MACD
histogram
day's range
(volatility)
volume vs
20-day norm
Oldest row = 14 trading days before the forecast day.
Newest row (t) = the last close known when the forecast is made.
What each feature measures, and how far back it looks
FEATURE
WHAT IT TELLS THE MODEL
LOOKS BACK
1-day return
How much the price moved today.
1 day
5-day return
The move over the past week.
5 days
Price vs 20-day average
How stretched the price is above or below its short-term trend.
20 days
20- vs 50-day average
Whether the medium-term trend is rising or falling.
50 days
RSI (centred)
Whether recent gains or losses look overdone.
14 days
MACD histogram
Whether momentum is building or fading.
about 35 days
Day's range (Parkinson)
How wide the day's high-to-low swing was.
1 day
Volume vs 20-day norm
Whether trading was unusually busy or quiet.
20 days
Trend and volatility features are divided by the stock's recent 20-day volatility, so a quiet stock and a volatile one look comparable to the model.
Sees further than 15 days
The table has 15 rows, but each row already summarises 20 to 50 days of history (the 50-day average, MACD and volatility). In effect the model sees about two to three months, compressed into features.
Not in the vector
News headlines, sentiment scores, SEC filings, earnings dates, company fundamentals and the wider market index. The Back-test news evidence is shown beside the forecast to give context. It is not an input to the model.
Source: AI4Finance Lab AI Prediction model (train_lstm.py): window L = 15, 8 features, horizons 1 and 5 days, 16 hidden units. Matrix colours are illustrative, not real data. Research tool, not investment advice.

On a phone, scroll the infographic sideways. Research tool, not investment advice.