Skip to content
All library documents

A Small Neural Network for One-Bar-Ahead Price Prediction

Article TradingView scripts

Summary

This educational indicator demonstrates a small feed-forward neural network that predicts the current close from the prior two closes. It normalizes prices by the maximum high observed so far, applies sigmoid activations in a two-unit hidden layer and a single output, and trains weights with mean squared error and gradient updates. Users can set the learning rate and epoch count, select between two backpropagation implementations, and display the training loss curve alongside the prediction and actual value.

Training runs on the last confirmed historical bar, so the example illustrates mechanics rather than a continuously updated forecasting system. The document provides no forecast accuracy, benchmark, trading simulation, or out-of-sample evaluation. Its input set is limited to two lagged prices, and the displayed loss reflects training on the example input rather than evidence of generalization. The page also sketches how a library-based neural-network implementation could reproduce the architecture, but the main example is intended as an educational showcase.

Key ideas

  • The network uses two lagged closing prices as inputs and a single closing price as its prediction target.
  • Prices are scaled by the running maximum high, and sigmoid activations produce the hidden and output values.
  • Mean squared error guides weight updates through backpropagation over a configurable number of epochs.
  • Training and prediction occur on the last confirmed historical bar, limiting the example's use as a live forecasting method.
  • The document provides no out-of-sample accuracy or evidence that the prediction supports a profitable strategy.

Tags

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