Option Strategy Based Upon Underlying


Category:
0
0

Thank you so much for the great site!  It has helped me so much as I work to pick up thinkScript.

I have a strategy programmed that I’d like to use as an options buying strategy, but the strategy is actually based upon and applied to the movement of the underlying stock.  Is it possible to create a strategy for the underlying stock (applied to its chart), but access ANY options data when it comes time to add an order in the strategy?

Ultimately, when it comes time to add the order in the strategy, all I want to do is grab the Theo Price of one of the options with a strike price that is close to the current price of the underlying stock.  The motivation here is that I’m just trying to track P/L based upon price of the option purchased/sold, as opposed to the underlying stock itself.

Is it possible to retrieve this data from a strategy that is applied to the underlying stock?  Or worst case, try estimate the price of the option when it comes time to add the order?

Marked as spam
Posted by (Questions: 1, Answers: 1)
Asked on May 18, 2020 2:02 pm
316 views
0
I guess my response to my own question was posted too quickly. :) It doesn't seem that the Options related functions work while applied to underlying chart. :( This would be very sad to me if true.
( at May 18, 2020 2:21 pm)
1
Private answer

The chart strategy tool only works on the ticker symbol loaded onto the chart. At this point I have not found a way to build a chart strategy in Thinkorswim that can trade options for the underlying in place of the underlying itself. In fact I have never even seen this done for any trading platform. The solution is so complex that it requires a team of software developers to complete. Market Makers certainly have access to these tools. If you find a system that can do this, expect to pay several thousand dollars.

Edit: In the comment section below the author of this post has asked if the request was properly understood, or if the question was expressed clearly. Specifically, the question is: "When chosen trigger hits on underlying stock, buy the current at-the-money call." This simple use case is what takes teams of developers and computers to implement?

We have limited tools available in a scripting language to begin with. Furthermore, the Thinkorswim language provides a limited number of built-in functions used to work with options data within the context of a chart study or strategy. In the case of getting the current ATM option, have a built-in function named "GetATMOption()"

https://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Option-Related/GetATMOption

One of the required input parameters of this function is "Expiration Date". So it is much more than a matter of getting the ATM option, you need to tell the code the exact expiration date. Which for regular weekly and monthly options in the U.S. markets is the Saturday after the Friday of expiration.

Once again we run into limitations within the Thinkorswim language. There are no tools in the language that can automatically generate an expiration date that can by used as the input to the GetATMOption() function.

Any chart strategy that would attempt to do this would require a list of expiration dates to be used for each month (or week) that the strategy is trying to plot theoretical buys and sells. That list would need to be hard coded into the script or provided as user inputs that would be manually adjusted as needed.

Additional logic would need to be added to the chart strategy to tell the code which of those manually input expiration dates to use for any given portion of the historical data on the chart. For each theoretical buy/sell on the chart there will be no way of knowing which option the strategy selected. The strategy is very likely to buy one and sell another. Busted and broke, right there.

Sorry but I have already spent more time on this than I allow for solutions in the Q&A forum. I have just explained this in sufficient detail to explain just one of many dead-ends when trying to crack this problem. Hopefully this will suffice in convincing folks how incredibly challenging this is.

Manually selecting an ATM option is a very complex process. We take it for granted after we have worked in this environment for some time. Most of the time you are looking through the list of expirations to locate the ATM option that has the ideal characteristics such as the Implied Volatility, Historical Volatility, Delta, Bid/Ask spread, volume and open interest (and many others). If you are not checking all of these things each time to buy an ATM option you are missing the mark. How do you write the code so that it can evaluate each of these elements to select the expiration date that is ideal according to your goals and trading methodology? The enormous complexity of these selections is why it takes a team of developers to construct code that can properly evaluate this vast array of data points and at the same time adapt to various conditions and trading methodologies.

Marked as spam
Posted by (Questions: 37, Answers: 4118)
Answered on May 18, 2020 2:34 pm
0
Why would the solution be ”so complex”? Or to put it another way, why would it be hard for a strategy running on the underlying chart to have access to the related Option Grid and it’s data? I mean TOS already has access to both at the same time anyway. I could see it being difficult in terms of historical data, because that would be a ton of data to store, but you could even store intermediate values and ”estimate” the in between to some degree. At least in my head this makes sense as a long time developer and software architect. ? Thanks for the confirmation though!
( at May 18, 2020 3:47 pm)
0
Please just take my word for it. I have a colleague that writes far more complex solutions than anything I am capable of and he is not able to do this either. I actually had a client that wanted an automated trading system to perform almost exactly what you have requested and my colleague said was extremely difficult if not impossible to accomplish and very expensive. And that was using Interactive Brokers and some custom code written in Python. Thinkorswim cannot even dream of being able to do this. Light years away. So when I said "Market Makers certainly have access to these tools". I was speaking of Goldman Sachs, JP Morgan and other commercial investment banks. We are talking about rooms full of computer and data scientists.
( at May 18, 2020 7:08 pm)
0
Thanks Pete! Just so we're clear, I'm not doubting your response at all, rather I'm thinking I'm maybe not asking my question clearly enough. You know your stuff WAY beyond me. :) Let me ask one more way, and you tell me if that is what you were responding to. "When chosen trigger hits on underlying stock, buy the current at-the-money call." This simple use case is what takes teams of developers and computers to implement?
( at May 23, 2020 7:31 am)
0
I have updated my answer to provide more detail.
( at May 23, 2020 10:49 am)
0
Thanks Pete! Your longer answer definitely helped me understand the context of your response. I’ve actually cracked one of the obstacles you mentioned in thinkScript itself, and that’s a script that tracks whether a PUT or CALL specifically is currently open and which type was opened, and thus it can then decide whether it needs to close/open a position at any given point. I’m happy to share with you on the side if you’d like to see it. And I totally hear you about the expiration dates, and I am in fact open to writing my script so that I would just hard-code those, and then apply to 3 month periods manually at a time. But I don’t believe the GetATMOption() function can be called from a strategy that is running on the underlying stock – that to me is my only problem left to solve. I have all the entry/exit points scripted for PUTS/CALLS. I just need a way to say ”what is the ATM CALL/PUT option” for chosen (hard-coded) expiration right now – but doesn’t seem I can. You are correct that for right now, I’m not looking at gamma/theta/delta for the time being. I’m solely using DeMark studies for now as decision points. Let me know if you want to see my script… I’m pretty proud of the hackery I had to put in there to make a bunch of this work. ?
( at May 24, 2020 8:52 am)
-1
Private answer

I'm an idiot.   I've been looking for articles for a week.  And right after posting this, I see that there are multiple options related functions in thinkScript to return what I believe I'm asking for.  Examples:

GetOption()
GetATMOption()
OptionPrice()

Rather than delete my question, I thought I'd leave this answer here for others that may also be interested in a similar approach.

Your site is awesome....  thank you so much again!

Marked as spam
Posted by (Questions: 1, Answers: 1)
Answered on May 18, 2020 2:09 pm