Skip to content
All library documents

Neural Networks for Technical-Indicator-Based Stock Forecasting

Article Quant Q&A · Author: Adnan Tamimi

Summary

The discussion considers building a neural network to generate buy, sell, or hold signals from stock prices and technical indicators such as RSI and Williams %R. The response recommends defining a prediction horizon and labeling the direction of returns over that horizon, with triple-barrier labeling offered as a more advanced alternative. It also points to feature transformations that encode trend expectations.

The advice cautions against feeding raw price levels because they are non-stationary, suggesting returns instead, and notes that short-horizon returns can be difficult to forecast. It proposes considering weekly or monthly horizons and adding volume and a broad market factor. These are general suggestions, not validated findings for the proposed dataset; the document reports no backtest or performance evidence. The feature set and labeling choices would still need careful testing, including safeguards against leakage and realistic transaction costs.

Key ideas

  • A classification model can predict return direction over a clearly defined horizon.
  • Triple-barrier labeling is presented as an advanced way to assign target classes.
  • Trend-oriented transformations may help make technical indicators more informative as model inputs.
  • Raw price levels are discouraged in favor of return-based features because prices are non-stationary.
  • The response suggests testing longer horizons and adding volume and a broad market factor.

Tags

Full text
# How to use neural network for technical analysis?


# How to use neural network for technical analysis?












I am working on building a Neural network for technical analysis of stocks. The input I have is the open price and two (so far) technical indicators : RSI and William's R - for the past 2 years. I can include more data points and features going ahead but as of now I just need to test the concept. I have the following questions on this:

- I had decided to classify stocks into 3 categories : BUY, SELL and HOLD using this model. Is this formulation appropriate ? If yes, is there a way to generate these target labels for training ? If no, what should be the appropriate target ?

- The neurons fire after a certain threshold but many indicators require a different interpretations than just a threshold limit. Does this need to be corrected for in the model or will it not have any impact ? If yes, what approach should be used to correct for it ?

Any help would be much appreciated.

## Answer by Jacques Joubert (score 2, accepted)

https://quant.stackexchange.com/a/50944

Q1: Moving to a classification setting, is to date the most common technique in the literature. Most typically is to predict the direction of a move over some defined horizon, say 1 day or 1 month. An advanced technique is to apply triple barrier labeling and drop the rare class labels.

Q2: Jigar Patel, et al wrote a good paper on trend deterministic data preparation which transforms technical indicators into an expectation of trend Paper. You may find this type of feature engineering useful.

Additional: If you are using only price data and price-related indicators then it is highly likely that your model will pick up on well-known factors, namely momentum and trend reversal. That will help you to engineer features that would be explanatory of exploiting those market anomalies. (Also note that you are unlikely to be able to exploit other factors without the correct explanatory variables)

I don't think your current feature set will be able to provide much value given:

- Can't use open price, its non-stationary. Most typical is to use the first order log difference of price which would be the log returns. Returns are assumed to be stationary and normally distributed, prices are log-normally distributed.

- Daily returns are very very difficult to forecast, try to shift to monthly or weekly returns.

- Add volume data as well as the market factor (S&P500), you may have some good success with a nonlinear CAPM style model.

The following is a good paper from the Journal of Financial Data Science: Neural Networks in Finance: Design and Performance

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

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