Code to backtest Long straddle and Strangle using Forcaseted IV

Dear Team ,



In Course , "Machine Learning for Options Trading" , in setion 19 & 20 tells us about Forecasting IV and testing short Straddle using the same .



I am looking for Condition for the code which can be used to test Long straddle and Long strangle using the Forecasted IV .



Any suggestions / Code would be of Great Help .



Thank you !!!

With Warm Regards

Nandagopal

Hi Nandagopal,



For testing long straddle, the conditions can be:

condition_1 = (options_data["current_mean"] < 0.2)
condition_2 = (options_data["pred_mean"] > options_data["current_mean"])

This means that the IV mean is currently low, and we are predicting the IV to increase in the future, which would increase the options premium and hence profit from deploying a long straddle.



However, this is just a sample entry condition, and you should thoroughly backtest and modify the same as per requirements and follow proper risk management. 



Hope this helps!



Thanks,

Akshay

Hi Akshay ,



Thank you !!!



Have one doubt. 



When using ML , we splitt the data into test and training set . Based on this we will find the best fit model .



Once the model is derived , how to use it to find or predict next 1 month price  where we know ony the dates . To find feature values when no input data is there .



For Eg:



For today , I have data till 11-Aug-2023 . I split the data in the ratio of 80:20 for Train and test data.

Once the best fit model is found , how can i use this Model to find the Next 1 month price till 31-Aug-2023



Thank you !!!

With Warm Regards

Nandagopal

 

Hello Nandagopal, 



Can you please provide more details of the example mentioned? When you say Next 1 month price till 31-Aug-2023, do you mean to predict the prices for every single trading day from Aug 12 till Aug 31st? or just the price on Aug 31st? 



Thanks and Regards, 

Varun Kumar Pothula

Hi Varun 



do you mean to predict the prices for every single trading day from Aug 12 till Aug 31st? 

Yes



Want to predict the prices for every single trading day from Aug 12 till Aug 31st.





Thank you !!!

With Warm Regards

Nandagopal

Hi Nandagopal,

Thank you for providing additional details.

Here's a clearer explanation of the process:



After training the model on the training data and confirming its accuracy using the test data, you can save the trained model. This model can then be used to make predictions on new data.



In your specific case, let's consider predicting data from August 12th onwards. On August 11th, you feed the feature data to the saved model and get predictions for August 12th. Repeat this process daily from August 12th to August 30th, generating predictions for August 13th through August 31st. Essentially, each day, you calculate the features, input them into the saved model, and obtain predictions for the next day.



Now the common question is how long should you use this model? 



You have the flexibility to train your model at regular intervals, say every n months, based on your preference.



It's advisable to regularly test the accuracy of your model's predictions at regular intervals. If the accuracy falls below a predetermined threshold (let's say x%), you can retrain the model using updated data. Subsequently, you can continue to use the retrained model for predictions, integrating new incoming data on a daily basis.



This approach ensures that your predictive model stays up-to-date, maintaining its accuracy and relevance over time.



If you have any further questions or need clarification, feel free to ask.

 

Hi ,



Thank you for undertsanding !!!

But the model will only predict if the test data input is given . if 11th AUG is test data , then it will predict only for 11th Aug . It won't predict for 12th Aug right .



Is my understanding correct .



Thank you !!!

With Warm Regards

Nandagopal

Hello Nandagopal,



In the realm of trading, machine learning-based time series prediction models are typically constructed and trained with the specific purpose of forecasting the price for the upcoming trading day.



Once the model has undergone the training and testing phases to validate its accuracy, you can pass the data of today to the model to predict the price of tomorrow.



In your example, once the model has been trained on historical data and its accuracy has been verified, you can input the data for August 11th to generate predictions for the prices on August 12th.



For further insights, you might find value in reading this blog, where an ML model is developed to predict the daily prices of a gold ETF.



I hope this helps!

Hi Varun 



Thank you !!!



Sorry for delayed response , Was testing the code .



Now i understood that if i give the current data , i would be predicting for tomorrow . 



Is there a way to predict 10days a Head .



Say i have a data till 11th Aug and I want to predict for till 20th Aug , is it possible?



Kindly shed some light and provide me the Insight .



Thank you!!!

With Warm Regards

Nandagopal

 

Hello Nandagopal, 



Predicting time series data 10 days ahead, especially in financial trading, can be challenging due to the inherent complexity and volatility of the markets. While machine learning-based time series prediction models can be useful for forecasting, the accuracy of longer-term predictions may diminish compared to shorter-term predictions.



Most time series models are designed for short-term predictions. To predict 10 days ahead, you may need to extend the forecasting horizon by using the model iteratively. For example, make a 1-day prediction, then use that prediction to inform the next day's forecast, and continue this process until you reach your desired 10-day horizon. This approach is known as a rolling forecast.



While it's possible to create models that offer insights for longer horizons, it's essential to understand that the accuracy of such predictions is likely to be lower. Therefore, caution is advised when considering these predictions as the sole basis for trading decisions.



Hope this clears your doubt!