Automated Option Price - Black-Scholes modelPlease make sure you are plotting this indicator on DAILY bars, not doing so will lead to unintended results. Also, make sure that you keep up to date the Risk-free interest rate, which you can consult (for U.S.) on ycharts.com.
This is an indicator that is meant to be used for Options Day Trading, but it can be useful for mid-term or leaps for I also enabled the possibility for user to input manually the Strike and Expiration date. I based the calculation on the Black-Scholes model. Variables included in the calculation are:
-Stock price (S): The current price of the underlying asset (e.g., a stock).
-Strike price (K): The predetermined price at which the option can be exercised.
-Time to expiration (T): The time remaining until the option expires, expressed as a fraction of a year.
-Volatility (σ): The annualized standard deviation of the stock's returns, which is a measure of the stock's price fluctuations.
-Risk-free interest rate (r): The annualized return on a risk-free investment, often approximated by the yield on a government bond.
The only variable I excluded from the original model was the Dividend yield (q).
U S E R I N P U T S:
1. AUTOMATIC calculations enabled:
i) Strike price (K):
Automatically calculate the strike price for both call and put options based on the stock's closing price. The logic follows a set of rules to determine the strike prices which will usually be Out-of-the-Money (OTM):
-If the stock's closing price is between 1 and 60, the call strike price is rounded up to the nearest whole number, while the put strike price is rounded down to the nearest whole number.
-If the stock's closing price is between 60 and 90, the call strike price is rounded up to the nearest whole number and increased by 1, while the put strike price is rounded down to the nearest whole number and decreased by 1.
-If the stock's closing price is between 90 and 120, the call strike price is rounded up to the nearest whole number and increased by 2, while the put strike price is rounded down to the nearest whole number and decreased by 2.
-If the stock's closing price is above 120, the call strike price is rounded up to the nearest multiple of 5, while the put strike price is rounded down to the nearest multiple of 5.
By applying these rules, I just tried to ensure that the automatically calculated strike prices are tailored to the stock's price range, allowing for more accurate option pricing calculations.
ii) Time to expiration (T):
The indicator will consider this week’s expiration contracts (Friday) only when the current day/bar = Monday. If Tuesday or older it will consider the expiration date of the next week’s Friday (because we are not Theta gamblers, right?).
If you are not comfortable with above for whatever reason, you can always…
2. Enter inputs MANUALLY
First make sure you UNTICK the boxes for automatic calculation.
i) Strike price (K) – Self-explanatory
ii) Time to expiration (T) – Just make sure that the horizon you are inputting matches with the next parameter (e.g. you would not input a Monthly risk-free interest rate for a Leap).
iii) Risk-free interest rate (r) – You can pull this data from the web. Here’s the link I used to define the value that this indicator was launched with:
ycharts.com
Don’t get obsessed with updating this daily if you are using this for day trading, you will notice that weekly may be more than enough.
V O L A T I L I T Y
Not option to manually input Volatility so I’ll explain how it is calculated in this script:
I considered two measures of volatility; one is derived calculating the annualized volatility using the standard deviation of daily returns and the second one is the ATR-based annualized volatility. I then used a ‘combined’ approach with the harmonic mean and the arithmetic mean of these results which can help account for the variability in the option prices calculated with different volatility estimates, which can be more robust when dealing with outliers or skewed data. I back tested with some samples of actual option prices and found that this approach is the one that got results closer to the actual bids.
T A B L E
Nomenclature to read rows is:
Option Strike Price | Type of Option (Put or Call) @ The current Close or at 50% level of bar | Estimated Price
*The Option expiration Date showed as dd-MMM as part of the headers.
Second and third row (color 1): These will show the calculated value for the Put/Call, assuming you are buying at the CURRENT price of the stock.
Third and Fifth row (color2): These will show the calculated value for the Put/Call, assuming you buy at the 50% level of the current bar (this is the value that the contract WOULD HAVE at the 50% level of the bar).
If you plot the indicator during market hours it will obviously update as price moves, this is an intended feature.
L I M I T A T I O N S
The Black-Scholes model, like many other models, has its limitations and will oftentimes provide inaccurate option prices in all market conditions. High volatility events, such as earnings announcements, can lead to significant price fluctuations that are not fully captured by the model.
The model assumes that the stock price follows a continuous random walk with constant volatility, but in reality, volatility can change over time, and stock prices can exhibit jumps, especially around significant events like earnings announcements. This can cause the model to underestimate the true option price in such situations.
Please make sure that you first back test on the symbols you trade to ensure the information presented by this indicator will suit your trading strategy. You will find that the delta between the proposed price of the indicator versus the actual price may differ significantly in some symbols while for others it will be very close. For instance, today (13APR23), the prices for AMD, DIS, AAPL (puts only), were very close to actual bids, whereas TSLA differ significantly (but then again, take a look at the calendar and this last symbol is having earnings next week which may add a premium to the contracts)… I am sure you will get your own conclusions and applicable use cases based on the data you test with.
As always, be wise and methodical on the investment or trading decisions you make!
Puts
Weekly Put SaleWeekly Put Sale
This study is a tool I use for selling weekly puts at the suggested strike prices.
1. The suggested strike prices are based on the weekly high minus an ATR multiple which can be adjusted in the settings
2. You can also adjust the settings to Monthly strike prices if you prefer selling options further out
3. I suggest looking for Put sale premium that is between 0.25% to 0.75% of the strike price for weekly Puts and 1% to 3% of the strike price for monthly Puts
Disclaimers: Selling Puts is an advanced strategy that is risky if you are not prepared to acquire the stock at the strike price you sell at on the expiration date. You must make your own decisions as you will bear the risks associated with any trades you place. To sum it up, trading is risky, and do so at your own risk.
pricing_tableThis script helps you evaluate the fair value of an option. It poses the question "if I bought or sold an option under these circumstances in the past, would it have expired in the money, or worthless? What would be its expected value, at expiration, if I opened a position at N standard deviations, given the volatility forecast, with M days to expiration at the close of every previous trading day?"
The default (and only) "hv" volatility forecast is based on the assumption that today's volatility will hold for the next M days.
To use this script, only one step is mandatory. You must first select days to expiration. The script will not do anything until this value is changed from the default (-1). These should be CALENDAR days. The script will convert to these to business days for forecasting and valuation, as trading in most contracts occurs over ~250 business days per year.
Adjust any other variables as desired:
model: the volatility forecasting model
window: the number of periods for a lagged model (e.g. hv)
filter: a filter to remove forecasts from the sample
filter type: "none" (do not use the filter), "less than" (keep forecasts when filter < volatility), "greater than" (keep forecasts when filter > volatility)
filter value: a whole number percentage. see example below
discount rate: to discount the expected value to present value
precision: number of decimals in output
trim outliers: omit upper N % of (generally itm) contracts
The theoretical values are based on history. For example, suppose days to expiration is 30. On every bar, the 30 days ago N deviation forecast value is compared to the present price. If the price is above the forecast value, the contract has expired in the money; otherwise, it has expired worthless. The theoretical value is the average of every such sample. The itm probabilities are calculated the same way.
The default (and only) volatility model is a 20 period EWMA derived historical (realized) volatility. Feel free to extend the script by adding your own.
The filter parameters can be used to remove some forecasts from the sample.
Example A:
filter:
filter type: none
filter value:
Default: the filter is not used; all forecasts are included in the the sample.
Example B:
filter: model
filter type: less than
filter value: 50
If the model is "hv", this will remove all forecasts when the historical volatility is greater than fifty.
Example C:
filter: rank
filter type: greater than
filter value: 75
If the model volatility is in the top 25% of the previous year's range, the forecast will be included in the sample apart from "model" there are some common volatility indexes to choose from, such as Nasdaq (VXN), crude oil (OVX), emerging markets (VXFXI), S&P; (VIX) etc.
Refer to the middle-right table to see the current forecast value, its rank among the last 252 days, and the number of business days until
expiration.
NOTE: This script is meant for the daily chart only.