Backtesting intraday ITM option strategy close to expiration
Author: innertrader
Creation Date: 6/18/2018 12:30 AM
profile picture

innertrader

#1
Hi Eugene. I recently started looking into the Synthetic Option feature on WL.

Goal
I want to backtest trading options based on intraday strategy buy/sell signals on the underlying. I want to purchase a specified number of call or put option contracts that are minimally in-the-money, with a minimum number of days left to expiration.

References
Before creating this post I researched and reviewed the following:
https://www.wealth-lab.com/Forum/Posts/WL-6-9-Synthetic-Options-Contract-Reference-38029
https://www.wealth-lab.com/Forum/Posts/Any-way-to-pull-up-Options-data-for-backtesting-38049
https://www.wealth-lab.com/Forum/Posts/Options-Backtesting-Historical-Options-Data-32187
http://www2.wealth-lab.com/WL5WIKI/kbFAQsGeneral.ashx
I also reviewed the QuickRef and the WS Programming Guide and ran sample programs as Cone and you suggested.

Questions
1. Is my backtest goal achievable in WL? Do you have suggestions about how I should tackle this?
2. Is contract size set the same way as a position sizing (Raw or Portfolio + PosSIzer options)? 1 share = 1 contract?
3. Even though you are using B-S to price the option, I presume you cannot calculate the implied volatility (IV) because you don't know what the actual option pricing was at the backtest date? Or do you calculate a likely market price for the option based on the actual IV for the underlying on that date? (The latter would likely only be available for a limited number of global indices that the CBOE publishes an index for.)
4. If you are not using IV in B-S, are you using Historical Volatility (HV) and what timeframe?
5. From the code examples it looks like the second overload of CreateSyntheticOption() only supports monthly (3rd week) options. Is that correct?
6. Now that weekly (and soon daily) options are available, will the first overload of CreateSyntheticOption() support these by specifying expiryDate? (I can't find any code examples that use the first overload.)
7. I didn't understand your answer to jschneir https://www.wealth-lab.com/Forum/Posts/WL-6-9-Synthetic-Options-Contract-Reference-38029 #10-2 regarding daysToPlotBeforeCreation. What is this value used to do?


profile picture

Eugene

#2
2. 1 share (lot) = 100 contracts.
3, 4. Sorry, I'm not an options expert.
5. At least this is what the QuickRef suggests.
6. I don't understand your idea of daily options but since the QuickRef is very clear about definitions, have you tried to create such example for yourself? As Wealth-Lab would still return a Bars object, just pass some DateTime values and see output on the chart.
7. Splitting conversation over multiple threads this way is suboptimal. Please refer to post #13 in that thread and if questions remain, reuse that thread.
profile picture

Cone

#3
1. I think you can get a lot of mileage from the code and methods I created here (especially post #62)...
https://www.wealth-lab.com/Forum/Posts/How-to-code-quot-nearest-term-ATM-call-option-quot-38518
profile picture

innertrader

#4
QUOTE:
6. I don't understand your idea of daily options

@Eugene - Thanks for the responses. Glad to clarify this.
I was referring to the fact that weekly expirations (i.e., every Friday) are now available on popular indices and the trend is toward dailies. This week, for example, you can buy a SPY (ETF for S&P 500) option expiring Monday, Wednesday, and Friday. Soon maybe every day of the week? The second overload of CreateSyntheticOption() appears limited to monthly options (i.e., third Friday of every month)
profile picture

Eugene

#5
Thanks for the clarification. I wasn't aware of this. It's up to you to give it a try and let the forum know ;)
profile picture

Eugene

#6
QUOTE:
6. Now that weekly (and soon daily) options are available, will the first overload of CreateSyntheticOption() support these by specifying expiryDate? (I can't find any code examples that use the first overload.)

I think the answer is positive. Here's modified QuickRef example with a synthetic contract that starts "yesterday" and lasts a "week" into the future:
CODE:
Please log in to see this code.

As you can see, the 1st overload lets you specify an arbitrary duration with variable dates.
profile picture

innertrader

#7
Wow. That's good news. Thanks for doing that.
profile picture

innertrader

#8
@Cone - That topic you referred me to was a goldmine! Thank you. I read all the posts. It was all relevant and very close to what I want to do.

I would like to provide more details and questions. I decided to put these as a post in the topic you referred me to. I think these applies to both this topic and that one but I want to reference some of the posts in the referenced topic.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).