Custom Option Calculation


Category:
0
0

Hi there,

Very new here, but what a fantastic site!  Learning about TOS strategy was such an awesome function shared here!

Im hoping someone can help me with a question.  In the option chain in TOS you can set the chain to show various data points such as the greeks, last, ask etc etc.  I noticed you can also add custom items to the chain.

Im trying to do a simple calculation to display delta as a percentage of the ask price of an option, so delta/ask, but cant seem to find a way to do this.

Anyone have any information on how to do this?

Thanks in advance!

Marked as spam
Posted by (Questions: 2, Answers: 1)
Asked on September 6, 2018 11:20 pm
1341 views
0
Private answer

This is a great idea and a great question. The problem is the tools Thinkorswim says it’s supports for this are broken. For example we find this in the language reference: http://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Fundamentals/ask.html

This tells us that we can get the current ASK for a given option contract simply by entering this line of code in a custom quote: def askPrice = ask;

But that only returns NaN. Broken. And that webpage even declares this is only available in Custom Quotes, Study Alerts and Conditional Orders. Yet I have tested this and at the time of this post it does not work for Custom Quotes.

So, not wanting to give up. I tried using this: def askPrice = close(priceType = PriceType.ASK);

Nope, that’s broken too.

Those are the only two ways we have to do this. They are both broken. But even if that were working as declared, we have another problem with the function used to return the Delta. Referencing the Thinkorswim language reference once again: http://toslc.thinkorswim.com/center/reference/thinkScript/Functions/Option-Related/Delta.html

When I use this: plot delta = Delta();

The value is not correct. It’s close, but it’s off by .03 to 0.5 points. Which is huge when deltas are expressed as 0.50.

Sorry to give you the bad news. At this time it’s simply broken. Perhaps if enough folks report this to TDA support they will correct it. And if it ever does get fixed, everything I have explained here should give you enough detail to complete the request: plot data = Delta() / ask;

Marked as spam
Posted by (Questions: 37, Answers: 4117)
Answered on September 7, 2018 9:52 am
0

Hi Pete,

Thanks so much for taking the time to respond and looking into this!

Such a shame this isnt working, i will definitely reach out to support to see if a solution is available.

Where i was going with this was to enable good option selection for very short term breakup/breakdown plays in equities being long calls or puts. Whilst likely overly simplistic, and only valid at point of entry, in my mind the elements of an option price that work in your favour if the stock moves in your direction could be expressed as follows:

((Delta+Gamma) – (Theta+Vega) – option spread at entry)/ask, should give a quick view of where the best priced options are for a given strategy.

Was hoping could see the above in the chain for quick selection. Maybe an Excel/Google sheet with a Yahoo finance connection or RTD to TOS could produce something, but first point of order raise a support request.

Thanks again for investigating!

T

( at September 7, 2018 9:07 pm)
0
Hello, since I'm interested in the same topic I was wondering if anything changed so far with TDA and Thinkscript ?
( at September 6, 2021 4:49 pm)
0
I have since discovered the following line works: def askPrice = ask; But only if the time frame of the column is set to an intraday time frame and the markets are open for the regular session. This will not work while markets are closed or trading during extended hours session.
( at September 6, 2021 6:26 pm)
0
Thank you, very kind.
( at September 7, 2021 5:57 pm)