Generalized Black-Scholes-Merton w/ Analytical Greeks [Loxx] is an adaptation of the Black-Scholes-Merton Option Pricing Model including Analytical Greeks and implied volatility calculations. The following information is an excerpt from Espen Gaarder Haug's book "Option Pricing Formulas". The options sensitivities (Greeks) are the partial derivatives of the Black-Scholes-Merton (BSM) formula. Analytical Greeks for our purposes here are broken down into various categories:
Probability Greeks: StrikeDelta, Risk Neutral Density
(See the code for more details)
Black-Scholes-Merton Option Pricing The BSM formula and its binomial counterpart may easily be the most used "probability model/tool" in everyday use — even if we con- sider all other scientific disciplines. Literally tens of thousands of people, including traders, market makers, and salespeople, use option formulas several times a day. Hardly any other area has seen such dramatic growth as the options and derivatives businesses. In this chapter we look at the various versions of the basic option formula. In 1997 Myron Scholes and Robert Merton were awarded the Nobel Prize (The Bank of Sweden Prize in Economic Sciences in Memory of Alfred Nobel). Unfortunately, Fischer Black died of cancer in 1995 before he also would have received the prize.
It is worth mentioning that it was not the option formula itself that Myron Scholes and Robert Merton were awarded the Nobel Prize for, the formula was actually already invented, but rather for the way they derived it — the replicating portfolio argument, continuous- time dynamic delta hedging, as well as making the formula consistent with the capital asset pricing model (CAPM). The continuous dynamic replication argument is unfortunately far from robust. The popularity among traders for using option formulas heavily relies on hedging options with options and on the top of this dynamic delta hedging, see Higgins (1902), Nelson (1904), Mello and Neuhaus (1998), Derman and Taleb (2005), as well as Haug (2006) for more details on this topic. In any case, this book is about option formulas and not so much about how to derive them.
Provided here are the various versions of the Black-Scholes-Merton formula presented in the literature. All formulas in this section are originally derived based on the underlying asset S follows a geometric Brownian motion
dS = mu * S * dt + v * S * dz
where t is the expected instantaneous rate of return on the underlying asset, a is the instantaneous volatility of the rate of return, and dz is a Wiener process.
The formula derived by Black and Scholes (1973) can be used to value a European option on a stock that does not pay dividends before the option's expiration date. Letting c and p denote the price of European call and put options, respectively, the formula states that
Inputs S = Stock price. X = Strike price of option. T = Time to expiration in years. r = Risk-free rate b = Cost of carry v = Volatility of the underlying asset price cnd (x) = The cumulative normal distribution function nd(x) = The standard normal density function convertingToCCRate(r, cmp ) = Rate compounder gImpliedVolatilityNR(string CallPutFlag, float S, float x, float T, float r, float b, float cm , float epsilon) = Implied volatility via Newton Raphson gBlackScholesImpVolBisection(string CallPutFlag, float S, float x, float T, float r, float b, float cm ) = implied volatility via bisection
Implied Volatility: The Bisection Method The Newton-Raphson method requires knowledge of the partial derivative of the option pricing formula with respect to volatility ( vega ) when searching for the implied volatility . For some options (exotic and American options in particular), vega is not known analytically. The bisection method is an even simpler method to estimate implied volatility when vega is unknown. The bisection method requires two initial volatility estimates (seed values):
1. A "low" estimate of the implied volatility , al, corresponding to an option value, CL 2. A "high" volatility estimate, aH, corresponding to an option value, CH
The option market price, Cm , lies between CL and cH . The bisection estimate is given as the linear interpolation between the two estimates:
Replace v(L) with v(i + 1) if c(v(i + 1)) < c(m), or else replace v(H) with v(i + 1) if c(v(i + 1)) > c(m) until |c(m) - c(v(i + 1))| <= E, at which point v(i + 1) is the implied volatility and E is the desired degree of accuracy.
Implied Volatility: Newton-Raphson Method The Newton-Raphson method is an efficient way to find the implied volatility of an option contract. It is nothing more than a simple iteration technique for solving one-dimensional nonlinear equations (any introductory textbook in calculus will offer an intuitive explanation). The method seldom uses more than two to three iterations before it converges to the implied volatility . Let
until |c(m) - c(v(i + 1))| <= E at which point v(i + 1) is the implied volatility , E is the desired degree of accuracy, c(m) is the market price of the option, and dc/ dv (i) is the vega of the option evaluaated at v(i) (the sensitivity of the option value for a small change in volatility ).
Things to know
Only works on the daily timeframe and for the current source price.
진정한 TradingView 정신에 따라, 이 스크립트의 저자는 트레이더들이 이해하고 검증할 수 있도록 오픈 소스로 공개했습니다. 저자에게 박수를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 출판물에서 이 코드를 재사용하는 것은 하우스 룰에 의해 관리됩니다. 님은 즐겨찾기로 이 스크립트를 차트에서 쓸 수 있습니다.