That's close enough for meVERY close.See attached.
I believe I did look at that in the past but it comes down to the same thing (volatility input) It's no use paying $125 just to get the same inaccurate option price I can get using the excel spreadsheet Also I am not sure if the software is the same as the website but when I entered the volatility 10.86 and it rounded it up to 11 which will throw off the option value if it actually does thatName starts with Hoad...
marcas, i find that my spreadsheet model is very useful. a year or so ago, when i started trading dan's boxcarI don't say that modeling is useless - there are situations models are necessary, but for average or even advanced retail trader learning piano is indeed much better use of time
What do you do when there is no IV value like yesterday where a lot of the ITM put options in the 4500 range had no IV values ?You have to pull in the individual IV's of each option and run the calculation for each individual option across the axis in the black scholes equations
Function resolve_iv(call_flag As Integer, S As Single, X As Single, a As Single, T As Single, r As Single, iv As Single, q As Single)
' q = div , T = time to expiration
' r = risk free rate . iv = volatility
' a = option price , S = stock price ; X = strike price
' ported from python routine from gary whitlock
Dim high As Single
Dim low As Single
Dim precision As Single
Dim IVTrial As Single
Dim TheoPrice As Single
high = 500
low = 0
precision = 0.0001
While ((high - low) > precision)
IVTrial = (high + low) / 2
If (IVTrial < 0.00001) Then
resolve_iv = ((high + low) / 2)
Exit Function
End If
' TheoPrice = BlackScholes(call_flag, S, X, T, r, IVTrial, q)
TheoPrice = calc_fair_value(call_flag, S, X, IVTrial, T, r)
If (TheoPrice > a) Then
high = (high + low) / 2
Else
low = (high + low) / 2
End If
Wend
resolve_iv = ((high + low) / 2)
End Function
FYI: the "volatility" value that my BSM function receives is NOT a percentage, but a real. I am guessing 1.00 to your BSM would be 1%, which would explain the difference. Also, that value 5 (or 500%) is good for most interesting SPX strikes, but may not be large enough for some "wilder" products like UVXY. So if one observes a resulting value of 0 or 500%, then the function did not converge, and a larger "high" value may be needed. Doubling that high value will add one more iteration to the convergence.when the bid/ask spreads become wide, sometimes it creates a situation where the iv calculations can't resolve to a valid number. in that case, thinkorswim just doesn't post a value. switching to volatility smile approximation mode causes the iv for calls and puts, of the same strike, to have the same value, which is different from the values calculated using the individual implied volatility mode. that should raise warning bells in your head. in general, you should not expect the iv calculated from a different model to result in the same fair value, when used in your model. it may be close, but i've found most times it's not close enough for me.
i ported gary's iv calculation routine to visual basic. you can use this as a macro in excel. i don't know if this can be done using only equations, but i won't pursue that. btw, i think gary has a typo in his code for the high initial value. i used 500, which allowed this iv calculation to agree with the iv from my own algorithm.
Code:Function resolve_iv(call_flag As Integer, S As Single, X As Single, a As Single, T As Single, r As Single, iv As Single, q As Single) ' q = div , T = time to expiration ' r = risk free rate . iv = volatility ' a = option price , S = stock price ; X = strike price ' ported from python routine from gary whitlock Dim high As Single Dim low As Single Dim precision As Single Dim IVTrial As Single Dim TheoPrice As Single high = 500 low = 0 precision = 0.0001 While ((high - low) > precision) IVTrial = (high + low) / 2 If (IVTrial < 0.00001) Then resolve_iv = ((high + low) / 2) Exit Function End If ' TheoPrice = BlackScholes(call_flag, S, X, T, r, IVTrial, q) TheoPrice = calc_fair_value(call_flag, S, X, IVTrial, T, r) If (TheoPrice > a) Then high = (high + low) / 2 Else low = (high + low) / 2 End If Wend resolve_iv = ((high + low) / 2) End Function
FYI: I believe a close estimation to the proper interest rates for SPX is the similar term LIBOR rate, so if you are working on a 30DTE option, then the 1M may be close approximation. Seems it is avail via RTD as =RTD("tos.rtd", , "LAST", "USD1MTD156N:FRED")Ah nice, I'll have to try that Jim, thanks for posting that. Question for you - where do you pull the dividend rate for the SPX? Right now, I'm just plugging assumptions for both the dividend rate and interest free rate. The Yield rtd function doesn't pull a value on the index.
FYI: the "volatility" value that my BSM function receives is NOT a percentage, but a real. I am guessing 1.00 to your BSM would be 1%, which would explain the difference.

Even during trading hours TOS sometimes goes berserk and shows no IV.