3
$\begingroup$

Overview

I'm training an index e.g. FTSE100, where I have 8 years of past data (daily). I also have a list of its constituents.

For each stock, I have the following features: Date, Open, Close, High, Low, Volume Traded

SCALING

I decided to predict whether to buy/sell the index. Instead of using close values, I decided to optimise for percent change, hence I create a new variable percent_change, which is not bounded by 1. Does this make it a bad metric, and should I use close prices instead?

Why I didn't use close values?

I wasn't sure how to scale it to run it properly. Currently, my model input is 10 previous percentage changes, e.g. [t0, t1, ... , t10] predicting [t11] where ti is the percentage change on day i.

If I was to use scaling, I would constantly come across new values. Additionally, if tomorrow brings a new all time high, I will need to rescale the data and re-train the model.

Additionally, I thought about replacing percent change by actual index denoted by pi. I thought about scaling just the moving window period [p0, p1, ... , p10], however, the predictor [p11] could be outside the bound of 1.

Question: Does LSTM easily handle inputs and outputs > 1?

FEATURE SELECTION

Please advise me which independent variable to use: percent change or close price (and how should I scale it). I've trained the model on 2500 observations (500 epochs) giving me a 53% accuracy on the test set (is it good?). I also made 30% returns over 600 test days. Currently the only features I'm using are rates of change for the past 10 days.

Which features did my model learn?

I'm not sure. Did it learn moving averages, linear gradients/approximations volatility etc.? Or should I include them in my model as [t0, t1, ... , t10, MA10days, MA3days, Gradient3day, Volatility3day] ?

TRAINING THE MODEL

Since I have 100 constituents, would it make sense to run/pre-train the same model on all of these stocks? All stocks are highly correlated with the index, and I thought about calculating MA, Gradients and so on for each of the Close, Open, High, Low and then running PCA to select only a few components.

IF YOU MADE IT THIS FAR

I know this is a long question to ask, and I thank you for any help given, I will reward the 100 points that I have to the best answer! Thanks

$\endgroup$
2
  • $\begingroup$ Question: Does LSTM easily handle inputs and outputs > 1? Yes, if it is not very different from 1. All parameters in a neural net should be between 1 and -1. You cannot introduce the prices directly, you always have to normalize. Question 2: Which features you have to use? Well, that is the art of forecasting. You can use indicators, your own indices, etc. $\endgroup$
    – nunodsousa
    Jan 29, 2018 at 11:33
  • $\begingroup$ Btw, you should try to use logReturns instead. $\endgroup$
    – nunodsousa
    Jan 29, 2018 at 11:35

1 Answer 1

3
+100
$\begingroup$

If I was to use scaling, I would constantly come across new values. Additionally, if tomorrow brings a new all time high, I will need to rescale the data and re-train the model.

You're actually facing 2 underlying problems:

  1. This is less of a problem of scaling than a problem of stationarity. A simple solution to this is to take first differences of close prices instead of raw close prices.

  2. The more trivial issue is the robustness of your scaling step. There's various ways to counter this. In the case of min-max scaling that you're using, one possible way to address this is winsorization, where you artificially censor all features $>1$ to 1. If you don't want to censor your data, you could use z-scores instead. Without knowing the exact training setup, it's likely that you're scaling your data to improve the convergence of your LSTM solver, and unless your solver has a specific sensitivity to z-scoring or censoring, both approaches are practically feasible. (This sort of sensitivity may arise from more advanced tricks like meta-learning, e.g. learning an LSTM to optimize your LSTM.)

Which features did my model learn?

Depending on the software package that you used, it should have a results output or results object, which should give you feature scores or feature importances. However, neural networks are often used to combine features so the answer should be less of selecting features than finding new ones.

Did it learn moving averages, linear gradients/approximations volatility etc.?

These new features often have no simple, intuitive interpretation, so it can be quite meaningless to attempt to interpret the learned features as conventional quantities such as moving averages. This is a common weakness of neural networks.

Since I have 100 constituents, would it make sense to run/pre-train the same model on all of these stocks?

It depends on what you're trying to model. If there's reason to believe that whatever you're trying to predict is drawn from the same ground truth distribution across all constituents, then sure, it's worth trying.

$\endgroup$
1
  • $\begingroup$ Thank you for this answer! Is using price prediction instead of percent change better for modelling? And, should I include moving averages, gradients as an input to the model? I'm building a simple model which just gives me a guideline whether I should buy or sell. $\endgroup$
    – GRS
    Jan 11, 2018 at 9:50

Your Answer

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

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