Serving the Quantitative Finance Community

 
User avatar
humtumiit
Topic Author
Posts: 0
Joined: April 28th, 2007, 6:20 pm

ANN based sotck price prediction

January 27th, 2012, 2:00 am

I am using artificial neural network for stock price prediction: Let us say, the stock price is trading around 120,121,120.4 ,..........I am plugging RSI, MACD, SMA10, EMA20, BB,ADX indicators in to the ANN as input data.My first question is:what would be the target value? Is it just the normalized value of closing price, original value or some number only between (0,1)My next question is:my activation function is sigmoid function, which gives output value between (0,1).while predicting the stock price after training, ANN predict output in between (0,1). How does value between 0 and 1 represent stock price? or how to interpret the number between (0,1) such that it gives stock price?
 
User avatar
acastaldo
Posts: 14
Joined: October 11th, 2002, 11:24 pm

ANN based sotck price prediction

January 27th, 2012, 3:43 pm

One (simple) way to do it, try to predict price direction:in sample period 1=rise in price tomorrow 0=fall in price tomorrow or unchangedout of sample period0.75= predict 75% probability of rise in price tomorrowetc.
 
User avatar
Fermion
Posts: 2
Joined: November 14th, 2002, 8:50 pm

ANN based sotck price prediction

January 27th, 2012, 9:14 pm

That depends on how you have trained your ANN, since you must relate the output to price in order to train it.Here is a simple scheme that conforms to the geometric nature of price and ensures the std dev of o is in the right ballpark:Calculate the training outputs as o = (P_out/P_in - 1) /(n*s) + 0.5, truncating between 0 and 1where s = std dev of (P-out/P_in - 1) and n = some multiplier that dictates the maximum price change you consider appropriate.The, having trained your network, compute the predicted output price asP_out = P_in(1 + n*s*(o - 0.5))Ps. you might consider using tanh/2 as your transfer function instead of a sigmoid. It's essentially the same but has a built in symmetry so that you don't have to worry about adding and subtracting 0.5.
Last edited by Fermion on January 27th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
humtumiit
Topic Author
Posts: 0
Joined: April 28th, 2007, 6:20 pm

ANN based sotck price prediction

January 29th, 2012, 1:21 pm

QuoteOriginally posted by: acastaldoOne (simple) way to do it, try to predict price direction:in sample period 1=rise in price tomorrow 0=fall in price tomorrow or unchangedout of sample period0.75= predict 75% probability of rise in price tomorrowetc.When I predict the direction in intraday, the signal gave 1 (buy signal) or -1 (sell signal) as an output and because of high noise in the intraday data, after 3-4 ticks it predict the opposite signal which indicate to close off the position so the strategy make profit in raw terms but make losses after including commissions because price does not vary so much in small time.
 
User avatar
humtumiit
Topic Author
Posts: 0
Joined: April 28th, 2007, 6:20 pm

ANN based sotck price prediction

January 29th, 2012, 1:24 pm

QuoteOriginally posted by: FermionThat depends on how you have trained your ANN, since you must relate the output to price in order to train it.Here is a simple scheme that conforms to the geometric nature of price and ensures the std dev of o is in the right ballpark:Calculate the training outputs as o = (P_out/P_in - 1) /(n*s) + 0.5, truncating between 0 and 1where s = std dev of (P-out/P_in - 1) and n = some multiplier that dictates the maximum price change you consider appropriate.The, having trained your network, compute the predicted output price asP_out = P_in(1 + n*s*(o - 0.5))Ps. you might consider using tanh/2 as your transfer function instead of a sigmoid. It's essentially the same but has a built in symmetry so that you don't have to worry about adding and subtracting 0.5.I am also using the similar things to train the NN except the linear function as the activation function on the hidden layer to get the NN output. But this does not predict precise in intraday.
 
User avatar
tags
Posts: 3602
Joined: February 21st, 2010, 12:58 pm

ANN based sotck price prediction

January 30th, 2012, 8:24 pm

hello neural traders.i have 2 questions related to ANNs.1) google searches such neural+networks+finance or ANN+trading+predictions tend to return quite old papers (some dating back before the 2000s).are people still investigating in these area? or which other keywords should i better use?2) in the papers i've read so far, people use TA indicators as inputs to their AAN models. are you aware of attempts to plug term structure or other futures characterics? i hope i don't sound too weird.
Last edited by tags on January 29th, 2012, 11:00 pm, edited 1 time in total.
 
User avatar
spv205
Posts: 1
Joined: July 14th, 2002, 3:00 am

ANN based sotck price prediction

January 31st, 2012, 7:39 pm

you might want to google SVM ( ie support vector machines...)
 
User avatar
neuroguy
Posts: 0
Joined: February 22nd, 2011, 4:07 pm

ANN based sotck price prediction

February 3rd, 2012, 10:32 am

If you are using a multi-layer perceptron network with Backprop learning, then you are fitting a polynomial to your data.If you are not using weight regularisation then it is almost certainly overfitting to the data. So it doesnt surprise me that it doesn't work very well.Even if you are using regularisation then it will probably overfit and 'snoop' in the backtests.SVNs might be a more principled option, but in essence its is a similar thing if applied directly like this.My advice would be to think carefully about the data you are feeding to it and why.If you are training on raw data and expecting meaningful 'prediction' I would be very surprised if you find any great success.You might think instead about asking a network to give a buy/sell signal based on pre-processed data -> i.e. data that that has been turned into a feature set.Examples of simple features: Magnitude of open/close difference, magnitude of gap at open, points when moving averages crossed, points when Bollinger band crossed etc...It is also not impossible to define features for things somewhat akin to technical indicators.The networks should then be operating on feature vectors, not raw data.You might want to check out:-Graphical models-Hidden Markov models-Statistical learning I would estimate that these approaches will be far more successful that using an ANN (which is essentially a non-linear regression device).
 
User avatar
neuroguy
Posts: 0
Joined: February 22nd, 2011, 4:07 pm

ANN based sotck price prediction

February 3rd, 2012, 10:40 am

Sorry I just saw your list of indicators. Still, I would advise processing the input more than that.
 
User avatar
Stale
Posts: 0
Joined: November 7th, 2006, 3:20 pm

ANN based sotck price prediction

February 3rd, 2012, 12:17 pm

Hi,Quick question: By processing you mean scaling/transforming to obtain normalized and perhaps stationary data?Stale
 
User avatar
neuroguy
Posts: 0
Joined: February 22nd, 2011, 4:07 pm

ANN based sotck price prediction

February 3rd, 2012, 1:48 pm

I didnt quite mean de-trending (this would probably be detrimental if the strategy is at all directional)Rather I meant that I might look for patterns in the price data, perhaps using clustering techniques first. This might then provide underlying categorical inputs to the model.This could be combined with one or two indictors, perhaps ADX and BB.Another approach is to model each input as a distribution (which requires one do initial processing to determine the most appropriate form) and look for the resulting implied probability distribution of future price, or price direction (having learned the model with an appropriate technique).There is also quite a lot of redundancy in these indicators. Three are moving average based. I'm not so sure what you get from doing regression on moving averages of sligthly differing types. It risks introducing artifactual behavior (the longer scale moving average is just a filtered version of the short scale one).I would also be tempted to check that the complexity of the model is not to high by testing it on random data (which it should not be able to fit with any great certainty).
 
User avatar
Stew
Posts: 0
Joined: January 13th, 2011, 12:53 pm

ANN based sotck price prediction

February 13th, 2012, 5:51 am

Take a look at Ward's Neuroshell product. They have spent about 20 years developing ANN modelling tools specifically for financial prediction. By default they use a backprop ANN with 10 neurons (in a single hidden layer) to predict the % price change 10 bars ahead. These neurons use a sigmoid activation function without thresholding. From extensive research with this product I find that for use with financial markets, there is not usually enough data points for training models with 10 neurons (however many including Ward themselves disagree). I usually use 2 neurons and no more than 3 inputs. Their software can find the best inputs from a large number you provide too.SVMs and GPRs are definitely valid alternatives which are likely to produce similar results given appropriate hyperparameters.Hope that helps. Stewart Buttonwww.OnyxFinancial.co.uk
Last edited by Stew on February 12th, 2012, 11:00 pm, edited 1 time in total.