Skip to content
All library documents

Building a TensorFlow Neural Network for Next-Day Stock Direction

Article QuantInsti blog

Summary

This tutorial outlines a TensorFlow multilayer perceptron that predicts whether Tata Motors’ next daily close will rise. It derives eight inputs from daily OHLC data: price spreads, moving averages, short-period volatility, RSI, and Williams %R. The target is a binary next-day direction label. The workflow covers a chronological train/test split, scaling, network layers, variable initialization, ReLU activations, an optimization cost, and Adam training.

The article then turns predictions into long or short positions and compares cumulative strategy returns with market returns in a plot. It describes an implementation process rather than providing reliable evidence of profitability: the stated objective is to teach model construction, and it offers no performance statistics in the supplied text. It cautions that the example uses daily data over a limited historical period, encourages larger samples and faster-frequency data, and says further optimization would be needed. The excerpt also omits much of the fitting and evaluation detail, so leakage controls, trading costs, and robustness cannot be assessed.

Key ideas

  • The model uses eight OHLC-derived features and predicts whether the following day’s closing price is higher.
  • The data is divided sequentially into training and test periods, then scaled before model fitting.
  • The network has three hidden layers with decreasing neuron counts and uses ReLU activations and Adam optimization.
  • Predictions are mapped to long or short positions, with cumulative strategy returns compared against the market.
  • The article presents an educational workflow and gives no quantified evidence that the strategy is profitable.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.