SteadyOptions is an options trading forum where you can find solutions from top options traders. Join Us!

We’ve all been there… researching options strategies and unable to find the answers we’re looking for. SteadyOptions has your solution.

Leaderboard


Popular Content

Showing content with the highest reputation on 03/25/2024 in all areas

  1. 1 point
    The above is an excellent chart of the correlation. As can be seen. The correlation is extremely strong until the pandemic, where yields needed to forge out an even lower low. However, as soon as that correction was made, the two synced right back up again.
  2. 1 point
    I like the idea of applying ML to this strategy. Thanks for the detailed background on your process! Did you do any testing splitting up past data into a training set and a test set? And if so, what sort of accuracy have you seen for those predictions?
  3. 1 point
    So TLT follows WTI moves by some days and some issues and so WTI could be viewed like an 'indicator'. By curiosity I coded a Recurrent Neural Network (RNN) called Long Short-Term memory (LSTM) in Python. I am not a fan of such deep learning programs. A lot have been created these last years but the success in stock price prediction is weak due to the fact that stock price is a stochastic process. And randomness cannot be predicted. But, when a correlation does appear, these kinds of learning neural networks could be efficient. So why not to try with WTI and TLT since it seems that a (negative) correlation does exist. These kinds of RNN's need features to be trained on : they observe two signals and try to find a (anti-)correlation between both. Then, based on what they see, they try to make a forecast on how one of the signal (the trailer) would behave based on the model defined on past data. By the past, when I was still trying to forecast the future using neural networks I remember that I tried quasi all possible indicators (Bollinger, Ichimoku, all EMA's, etc.). None was sufficiently correlated to a given ticker to make a correct forecast. It is quickly said but just to give the idea. So, I wrote the code. This code utilizes a Long Short-Term Memory (LSTM) neural network to train a model for forecasting the TLT (Treasury Bond ETF) prices for the next nDaysForecast days based on the historical WTI (West Texas Intermediate) crude oil prices. Here's a brief overview of the steps involved: Data Downloading: Historical data for WTI and TLT for the past nYearsBack years is downloaded using the download_data function from Yahoo Finance. Data Preparation: The downloaded data is preprocessed using the prepare_data function. It scales the closing prices of the respective stocks to a range of (-1, 1) using Min-Max scaling. Sequence Creation: Sequences of input features and target variables are created using the create_sequences function. This function segments the data into input sequences (X) and corresponding target values (y). LSTM Model Definition: An LSTM model is defined using the LSTMModel class. This model consists of an LSTM layer followed by a fully connected layer (linear layer) to produce the output. Model Training: The LSTM model is trained using the historical WTI data. The training is performed for numEpochs epochs using the train_model function. Prediction: The trained model is used to make predictions for the TLT prices based on the historical WTI data. Predictions are made for the next nDaysForecast days. Uncertainty Calculation: The uncertainty in the predictions is calculated based on the root mean square error (RMSE) of the model. Plotting Results: The actual TLT prices, predicted TLT prices, WTI prices, confidence interval, and forecast range are plotted. Dashed horizontal lines are added for the max and min of the confidence interval, with their values annotated at the extreme right. So, in summary, I say to the program : look at the past data for TLT and WTI, see whether or not there is correlation (even negative) and, based upon what you see on WTI moves, build a model to try to forecast the future prices for TLT. Do it on 20 years of past data. I know that the correlation is not perfect, so compute the mean square error, based on what you observed in the past. Note that I do not say anything to my LSTM. I just ask to Here is the plot of the results : "Num Epochs" is a number of "generations". To say it quickly, the LSTM is training and learning. Each time it controls itself it improves itself by keeping only the best parameters of the model. Then it starts a new computation with the new parameters : it is the next "epoch". Here 2000 epochs have been used. Of course it must improves at each epoch, which is the case when I look at the "loss" curve (no shown here). We can see that RMSE is very low, which is a good news. I never got a RMSE so small using classic indicators by the past. I plotted the results in a dashed dark blue line and the confidence interval (based on RMSE) in results. What the LSTM says here is that, during the next 20 days, TLT would be supposed to go between $91.48 and $97.15, based on the correlation the program observed over the last 20 years between TLT and WTI. I am not saying that it is true. It is just a research, an exploration, a reflexion to be a base of discussion. As usual, any comments welcome!
This leaderboard is set to New York/GMT-04:00