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?

  • 2
    $\begingroup$ I've been thinking about your question and wanted to ask for some clarification. Sorry if this sounds daft, but does your NN output buy/sell signals based on time relevant values of TAs? Or are you trying to forecast something? $\endgroup$
    – rex
    Dec 18, 2013 at 15:39
  • $\begingroup$ As I understand, you are using NN for classification purposes, that is your outputs are: buy, sell, no action. This is something NN's are not good at. They are mostly used for regression. Correct me if I'm wrong. $\endgroup$
    – sashkello
    Mar 15, 2014 at 23:56
  • $\begingroup$ I would make a customized training in such case - instead of minimizing error with respect to some training set, maximize the return. $\endgroup$
    – sashkello
    Mar 15, 2014 at 23:58

3 Answers 3


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).


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.


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.


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.

  • 1
    $\begingroup$ This would teach the neural network frequencies, but it needs to learn expected values. For example if you get 1€ with prob 99% and lose 1Mio.€ with prob. 1%, then the NN would still learn that its a good deal. Check this out: stats.stackexchange.com/a/44844 $\endgroup$
    – user1157
    Jan 14, 2014 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.