Time Series in Finance
Financial data is sequential. Time series methods are designed for this type of data.
Classical Methods
- ARIMA: Auto-regressive integrated moving average
- GARCH: Volatility forecasting
- VAR: Vector auto-regression
ML Methods
- LSTM: Long short-term memory networks
- GRU: Gated recurrent units
- Temporal CNN: Convolutional networks
- Transformer: Attention-based models
Evaluation
- Walk-forward validation
- Purged cross-validation
- Out-of-sample testing
Why Financial Series Defy Simple Forecasting
Prices, volume and volatility are non-stationary: their mean and variance wander over time, so a model trained on 2019 behaviour misreads 2026 regimes. Financial forecasting is less about predicting a number and more about assigning probabilities to ranges, because the same input pattern maps to wildly different outcomes under different liquidity conditions. Every honest forecast starts by acknowledging this limitation.
The Baseline Models
AutoRegressive (AR) and Moving Average (MA) models, combined as ARIMA, capture linear autocorrelation in returns. They are cheap, stable and often beat fancy networks on short horizons where the signal is genuinely linear. The catch: ARIMA assumes stationarity, so you must difference the data and validate with a rolling window that never peeks into the test future.
Exponential Smoothing for Volatility Curves
Exponential Weighted Moving Average (EWMA) assigns decaying weights to older observations, letting the forecast track recent regime changes. It is the default for volatility estimation under RiskMetrics and works beautifully for option-implied surface smoothing. Choose the decay factor to match the speed of regime change you expect; in calm markets a slow decay version is more stable, in frantic markets a fast one responds.
Machine Learning for Financial Time Series
Gradient-boosted trees with shifted lags as features outperform naive aggregates on direction classification, especially when you include calendar features such as expiry day and the day before a holiday session. The discipline is the same as for any ML: use walk-forward validation only, keep the label horizon aligned with your holding period, and treat accuracy above 0.52 on daily index direction as a genuinely good result.
Dealing With Regime Shifts
- Use regime detection with a Hidden Markov Model over returns and volume before fitting any forecast.
- Forecast each regime separately and blend the probabilities instead of forcing one global model.
- Rebuild the training window whenever a detected regime breaks the model's residual behaviour.
- Keep both an event model and an econometric model; hedge the divergence between them.
Practical Forecast Validation
The only honest test is out-of-time, not out-of-sample: train on the first 80% of the calendar, predict the last 20%, and never allow the model to borrow future data for feature scaling or imputation. Track the hit rate over a rolling 60-day window, and when the hit rate drops below 50% for a full month, the regime has shifted and the model needs a rebuild rather than a patch.
Building a Forecasting-Ready Dataset from NSE Data
Before any model runs, the daily series must be pulled from the NSE bhavcopy, sorted strictly by date, and checked for three failures: missing sessions, duplicated dates, and non-trading days that still carry a stale close. A useful discipline is to rebuild a full calendar from the exchange holiday list and merge the price file onto it, so the model never mistakes a two-day gap for a two-week regime. Keep returns as the forecasting target, not levels; a model predicting price directly spends most of its capacity reproducing the last close and misleads on dates where the market gaps.
Stationarity Checks Before You Difference
Run an Augmented Dickey-Fuller test on the log levels and on the first difference. A typical Nifty sample of 2,500 daily bars gives an ADF statistic near -1.5 on levels and below -10 on returns, meaning the levels series is clearly non-stationary and the returns series is comfortably stable. If you need a second difference, question the data rather than the math; index data rarely requires more than one.
Choosing the Forecast Horizon
A daily-return model is credible at one to five days ahead; beyond that the noise floor swallows the signal. Longer horizons belong to volatility forecasts, where GARCH-style persistence survives for weeks. The reason is simple: the autocorrelation of daily index returns is close to zero, while the autocorrelation of squared returns remains meaningful, so direction decays quickly but risk persists. Split your project by what the number is actually for: a 3-day direction call for option direction, or a 20-day volatility projection for premium selling.
Recursive vs Direct Multi-Step Forecasts
For a five-day-ahead call there are two honest routes. Recursive forecasting feeds each predicted day forward into the next, compounding small errors; direct forecasting trains a separate model for each day, multiplying training cost but damping error build-up. On Nifty daily data the direct approach usually wins by a small margin once you count transaction impact, because the model for day five never inherits day one's mistakes. For computational sanity, cap multi-step work at five separate models rather than synthesising a ten-step chain.
Combining Forecasts and Bounding Uncertainty
No single method reliably beats a blend. A practical blend trains three learners on the same features - an ARIMA-style baseline, a gradient-boosted tree, and a ridge regression on engineered lags - then averages their standardised scores. The ensemble earns a small but durable accuracy gain precisely because each model fails on different days. Pair the point forecast with a confidence band built from the historical absolute error at each horizon; if the band widens sharply for day five, trade only the near-day signal.
- Daily regime: model the return, not the level.
- Horizon: keep direction to five sessions, volatility to twenty.
- Validation: refit on a moving window that excludes the test edge.
Turning the Forecast into a Trade Decision
The forecast earns money only as a decision rule. A defensible rule buys a call spread when the 3-day directional probability exceeds 58 percent and India VIX is below 16; any probability between 45 and 55 percent is a no-trade zone that prevents premium leakage through commissions. Track the hit rate on a 60-day window and refit the model whenever the rolling hit rate dips under 50 percent for a full month, because that is the signature of a regime change rather than ordinary noise.
Multi-Horizon Stacking and Refit Cadence
Forecasts at three horizons answer three different questions, and a practical project stacks them instead of merging them: a 1-day call decides tomorrow, a 5-day call decides the week's direction, and a 20-day volatility projection sizes the premium budget. Feed each horizon its own model, then reconcile the trio before trading; when the two direction models agree and the volatility projection is calm, the position earns a bigger vote than when they argue. Refit on a fixed cadence - weekly on daily data - and keep the last bars out of every feature window, because a model that refits daily chases yesterday and one that refits yearly sleeps through a regime. Python's statsmodels and scikit-learn cover the entire stack, from the ARIMA baseline to the boosted trees, and the honest pipeline logs every refit's date with its out-of-window score.