I am trying to predict Forex time series. The nature of the market is that 80% of the time the price can not be predicted, but in 20% of the time it can be. For example, if the price drops down very deep, there is 99% probability that there will be a recovery process, and this is what I want to predict.

So , how do I train a feed-forward network the way it would only predict those cases that have 99% of certainty to take place and, for the rest of the cases it would output "unpredictable" status?

Imagine that my data set has 24 hours of continuous price data as input (as 1 minute samples), and then as output I want the network to predict 1 hour of future price data. The only restriction I need to implement is that if the network is not "sure" that the price is predictable, it would outupt 0s. So, how do I implement safety in predictions the network is outputting?

It seems that my problem is similar to Google Compose, where it predicts the next word as you are typing , for example, if you type "thank you", it would add " very much" and this would be like 95% correct. I want the same, but it is just that my problem has too much complexity. Google uses RNNs, so maybe I should try a deep network of many layers of RNNs?


3 Answers 3


Things like this a really hot topic in research right now, and it's very difficult to get high accuracy on a chaotic system like the stock market. That being said, I would probably recommend preprocessing your data rather than having your primary neural network decide what to accept and what not to.

For example, in your specific case, you could model a bubble bursting as perhaps a negative exponential drop-off or something of the sort. This could include machine learning too. You could gather historical drops in stock market data, and use some sort of regression (Bayesian would probably work well) to estimate the best function to use as an indicator to whether a steep drop has occurred. If so, then use your neural network specifically to classify the fate of the stock. I would think you would have more success following a specialised route such as this rather than trying to train a network on general trends in the market.

In terms of the structure of your neural network, you may want to consider a convolutional neural network (CNN) instead of a recurrent neural network (RNN). RNNs assume the current point in your time-series depends on all previous points, from the beginning of your data. I wouldn't think this would hold true in general for the stock market. The filters a CNN learns are suited to learning to extract certain features and the CNN will apply the filters to specific portions of the data, in the way it considers optimal. They are both nonlinear models, but the CNN will be less computationally costly to train. You could also try a gradient-boosting regression approach instead of a neural network. That being said, something like an LSTM RNN (long short-term memory) won't necessarily be bad - just my two cents.


I do not know how you will apply your data to the techniques I'll give you some brief overview of techniques used in time series prediction:

  • Extended Kalman Filtering: This is a kind of control system approach and is generally used to control trajectory of missiles. Here is a question (based on an EKF paper) in our stack on this topic. You can check the paper for more details.
  • Echo State Networks: This is a kind of ML/NN approach with based on the idea of Liquid State Machines used in Neuroscience. Resources on the same.
  • RNNs/LSTMs/GRUs - Probably the most popular approach to predicting any time series data when you don't want to delve into the statistical approaches.
  • ARMA/ARIMA models: Entirely statistical approach with lots of maths, but libraries are available with implementation already done.
  • Deep Belief Networks: People have also tried forecast time series using fixed number of previous states input to a DBN. It's somewhat of a popular paper so I decided to put it here.

Finally you can look up this overview on time series modelling approaches. Reinforcement Learning is also used for time series prediction, but from what I have heard it is not very easy to do so. Here is a Google Scholar search result.

  • $\begingroup$ NOTE: As a data scientist it is up to you how you will convert data into a form acceptable to any of the aforementioned algorithms. From my experience time series data is the hardest to model, so don't be disheartened if techniques fail to provide the required results. You should ask an experienced person for proper guidance. $\endgroup$
    – user9947
    Commented Mar 10, 2020 at 14:02
  • $\begingroup$ Thanks! I think I am gonna go for reinforcement learning approach described in the Dota 2 Bot from Open AI. And I will be implementing this with FPGA boards using 16 bit floating point arithmetic. Maybe we can partner up and do this project together? Drop me a mail if interested. $\endgroup$
    – Nulik
    Commented Mar 10, 2020 at 16:42
  • $\begingroup$ @Nulik thanks for the offer. I currently have my hands full but best of luck on your endeavors. Keep me updated on our main chatroom 'The singularity' of your progress. $\endgroup$
    – user9947
    Commented Mar 10, 2020 at 16:46

Tbh I think stock prices are essentially impossible to predict as you're not taking into account the data from outside the stock market.

I'd argue any successful model would need to be trained on news, consumer sentiment, etc etc.

The only ones which maybe work are HFT.

  • 1
    $\begingroup$ that is not true, stock prices can be predicted, this was already proven by some systems that already work. They can't be predicted always, but at certain moments in time, they are very predictable. The "unpredictability" of stocks is promoted by academia, but academia doesn't have very good domain knowledge of financial industry. Otherwise we wouldn't have hedge funds making profits year after year and hedge funds use mathematical models. $\endgroup$
    – Nulik
    Commented Mar 7, 2020 at 20:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .