SegaRKO

Black-Scholes Model for American Options

SegaRKO 已更新   
This model uses Black's Approximation to price American Options. Black's Approximation is an extension of the traditional Black-Scholes model that allows the price of American Options to be approximated within the Black-Scholes Framework. This is necessary because the traditional Black-Scholes model only works on options that are exercised at expiry, not before; like American Options can be.

Black's Approximation approximates the value of an American option by:

1st. Calculating the theoretical price of a european call or put based on the strike price (K), spot price (S), annual return (sigma), time until expiry (T), times until the next 2 ex-dividend dates (t1 & t2), and the dividend paid out at times t1 and t2 (D1 and D2).

2nd. The theoretical price of an option expiring on the second ex-dividend date (t2) is calculated. This replicates exercising the option early.

3rd. Finally, the highest price of the two theoretical prices calculated in steps 1 & 2 is chosen as the approximated price.

How to use this:

1st. Input your strike price.
2nd. Input the risk-free-rate of the currency the option is based in.
3rd. Input the dividend yield for the next ex-dividend date. For example AAPL's dividend yield is 0.82 and will be paid out on August 7,2020.
4th. Input the time until the next ex-dividend date. For example AAPL's next ex-dividend date is August 7,2020, which is 61 days away. So you'd input 61 (this includes weekends and holidays).
5th. Input the dividend yield for the ex-dividend date after the next one. For example AAPL's dividend yield after the next one is 0.82 and will be paid out on November 6, 2020.
6th. Input the time until the next furthest ex-dividend date. For example AAPL's next ex-dividend date after Aug 7th, is on November 6, 2020, which is 152 days away. So you'd input 152 (this includes weekends and holidays).
7th. Input your time until expiry. You can do so in terms of days, hours, and minutes.
8th. Input your chart time-frame in term of minutes. For example, if you're using the 1 min time-frame enter 1, 4hr time-frame enter 480, daily time-frame enter 1440.
9th. Lastly, pick what type of option you want data for: Long Call or Long Put.

*Disclaimer, because Black's Approximation is mostly geared towards stocks, this will only work for stocks. Also, the time variables: time until expiry and time until the ex-dividend dates; don't automatically update. So you will have to update them each day.
版本注释:
This new update utilizes an actual cumulative distribution function rather than the many if statements that the previous version used. This makes the code more succinct and accurate. Additionally, this update allows you to choose the currency that the option is denominated in from the drop down menu provided. Once chosen, the model will input the risk free rate of that currency for you. Lastly, in this update to make the model more accurate you need to input the implied volatility yourself.
版本注释:
Fixed error in cumulative and probability distribution functions. Also, fixed the calculation of pi.
版本注释:
Optimized pi calculation.
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

想在图表上使用此脚本?