I am currently trying to predict the close price of the TSLA stock for March 2022 using LSTM model. Initially, I was using TSLA stock data starting from 2012 to of course March 2022. However, I was wondering if this is effective as the TSLA stock has undergone great changes in terms of its volatility, behavior, and momentum over the years. Below you can see the stock's price history starting almost 2014. After 2020 its behavior and momentum change drastically. Is there any way to extract only those last n months' data that can help predict future prices with higher accuracy?
In stock prediction with LSTM, is there a need to get a dataset for a specific time period in order to predict future close price?
The LSTM layer expects input of shape
(batch_size, n_timesteps, n_features), you could adjust
n_timesteps so that each sample uses only last n-month's data.
Also as you already noticed, the prices have undergone dramatic changes over time, this affects the modeling: your target is not stationary, and your features are probably also not stationary. (Given your context, I'm assuming you are using prices to predict prices.) You'll be much better off by predicting price returns and making some features that are stable over time.