Skip to content
All library documents

Choosing Neural Network Labels for Trading Signals

Article Quant Q&A · Author: user6762

Summary

The discussion explains how to define training targets when using neural networks with market indicators. Rather than selecting visually appealing entry points at random, the researcher should decide what outcome the model is meant to predict and label historical examples to match that objective. Possible targets include a future return, whether a return exceeds a threshold, a three-way direction or neutral class, a price extreme over a specified horizon, or a decision about when to exit a position.

The answers also describe a simple rule-based labeling approach using indicator conditions to assign hold, buy, or sell labels, followed by evaluation on out-of-sample data. Another proposal labels positions according to future price changes after accounting for transaction costs. Input choices, indicator look-back periods, scaling, and transformations can all affect results, so experimentation is needed. The discussion does not establish a best labeling scheme or provide empirical comparisons; labels must reflect a clearly defined trading question, and apparent predictive performance should be assessed on data not used for training.

Key ideas

  • Define the market outcome the network should predict before assigning labels.
  • Targets can represent returns, threshold events, direction, price extremes, or trade management decisions.
  • Indicator look-back periods and data transformations can affect model performance.
  • Rule-based signal labels are one possible way to build a supervised training set.
  • Evaluate the trained model on out-of-sample data and account for transaction costs when labeling trades.

Tags

Full text
# selecting test data for neural networks


# selecting test data for neural networks












I have been working on a neural network based on certain technical indicators. As people familiar with neural networks would know after developing a hypothesis, the developer is also supposed to provide a set of data to learn from. Now if were a case of developing neural networks for spam fitering I would provided it with sets of spam and non spam data. But in my case how do I select the buy/sell point...do I just randomly select the entry points where can visually see the movement in price that I desire or is there a better approach?

## Answer by TonyMorland (score 2)

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

You will find that the level of success you have using Neural Networks (NN) as a tool for financial market prediction is strongly dependent on what initially appear to be some quite subtle factors. In particular:

Input data: You mention using "certain technical indicators". I assume that you mean the standard TA set of price-based indicators such as Moving Averages, MACD, RSI, CCI, Stochastic oscillator, Williams %R, etc, and probably also some indicators related to trading volume. You will find that your NN results will be sensitive to the look-back periods that you use for each of these indicators and you will need to do some extensive experimentation with this, as well as normalizations and transforms of the indicators that you choose.

Output / Training data: Your output(s) from the NN can be either continuous-valued or discrete, e.g. binary {0,1} or ternary {-1,0,+1}. It is up to you to choose what type of output you want and this depends entirely on the question that you are attempting to answer (i.e. exactly what you are trying to predict) with the aid of the NN. You will find that NNs can be very sensitive to this. For example, from the human trader's perspective, the following questions may not seem very different but from the NN's perspective they are quite different:

1) How much will stock XYZ or the overall market rise (in points or in %) between today's close and tomorrow's close? (Continuous-valued output required).

2) During the same period, will stock XYZ rise by more than 3.5%? YES=1 or NO=0 (binary output)

3) Will stock XYZ rise significantly (output = +1), fall significantly (output = -1) or, within some tolerance, stay about the same (output = 0)?

4) Is tomorrow's (or today's ?) price likely to be the highest / lowest for the next week? (binary output)

5) If I buy today, should I close my position on Friday or hold over the weekend? (binary output, based on your studies of profitability, drawdown, & other trading metrics).

etc.

If you have less success than you hoped for with your NN, then try asking a slightly different question. Also remember that sometimes even a small "only-slightly-better-than-random" result may still be enough to give you a useful edge in trading.

## Answer by delta hedge (score 1)

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

Neural networks are a supervised machine learning algorithm. Unlike unsupervised machine learning, the key to supervised machine learning is the selection of input factors and explicit labeling of outputs.

Input factors have to be manually selected, such as your combination of technical / fundamental / statistical indicators. Outputs have to be explicitly labeled (buy / sell signals) based on your selected input factors.

For example, a super-simple example could be:

f1 = X day moving average crossing above Y day moving average

f2 = ADX above Z

You would then create a training set using these factors and labeling your output:

f1 = 0, f2 = 0 --> hold

f1 = 1, f2 = 1 --> buy

f1 = 1, f2 = 0 --> buy

f1 = 1, f2 = 1 --> sell

Then train your NN network against this training set. Once the NN is trained, you should run the NN set on an out-of-sample test set to evaluate the performance of the NN.

## Answer by brian (score 0)

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

I just look at the future and decide what position I would have wanted.

If $price_{t+interval} > price_t$ + transaction costs then position = 1.

less than would be -1 and flat would be 0.

So now I would have a matrix of indicators and desired position at time t.

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.