loxx

Cox-Ross-Rubinstein Binomial Tree Options Pricing Model [Loxx]

Cox-Ross-Rubinstein Binomial Tree Options Pricing Model is an options pricing panel calculated using an N-iteration (limited to 300 in Pine Script due to matrices size limits) "discrete-time" (lattice based) method to approximate the closed-form Black–Scholes formula. Joshi (2008) outlined varying binomial options pricing model furnishes a numerical approach for the valuation of options. Significantly, the American analogue can be estimated using the binomial tree. This indicator is the complex calculation for Binomial option pricing. Most folks take a shortcut and only calculate 2 iterations. I've coded this to allow for up to 300 iterations. This can be used to price American Puts/Calls and European Puts/Calls. I'll be updating this indicator will be updated with additional features over time. If you would like to learn more about options, I suggest you check out the book textbook Options, Futures and other Derivative by John C Hull.

***This indicator only works on the daily timeframe!***

A quick graphic of what this all means:
In the graphic, "n" are the steps, in this case we can do up to 300, in production we'd need to do 5-15K. That's a lot of steps! You can see here how the binomial tree fans out. As I said previously, most folks only calculate 2 steps, here we are calculating up to 300.

Want to learn more about Simple Introduction to Cox, Ross Rubinstein (1979) ?
Watch this short series "Introduction to Basic Cox, Ross and Rubinstein (1979) model."

Limitations of Black Scholes options pricing model
This is a widely used and well-known options pricing model, factors in current stock price, options strike price, time until expiration (denoted as a percent of a year), and risk-free interest rates. The Black-Scholes Model is quick in calculating any number of option prices. But the model cannot accurately calculate American options, since it only considers the price at an option's expiration date. American options are those that the owner may exercise at any time up to and including the expiration day.

What are Binomial Trees in options pricing?
A useful and very popular technique for pricing an option involves constructing a binomial tree. This is a diagram representing different possible paths that might be followed by the stock price over the life of an option. The underlying assumption is that the stock price follows a random walk. In each time step, it has a certain probability of moving up by a certain percentage amount and a certain probability of moving down by a certain percentage amount. In the limit, as the time step becomes smaller, this model is the same as the Black–Scholes–Merton model.

What is the Binomial options pricing model ?
This model uses a tree diagram with volatility factored in at each level to show all possible paths an option's price can take, then works backward to determine one price. The benefit of the Binomial Model is that you can revisit it at any point for the possibility of early exercise. Early exercise is executing the contract's actions at its strike price before the contract's expiration. Early exercise only happens in American-style options. However, the calculations involved in this model take a long time to determine, so this model isn't the best in rushed situations.

What is the Cox-Ross-Rubinstein Model?
The Cox-Ross-Rubinstein binomial model can be used to price European and American options on stocks without dividends, stocks and stock indexes paying a continuous dividend yield, futures, and currency options. Option pricing is done by working backwards, starting at the terminal date. Here we know all the possible values of the underlying price. For each of these, we calculate the payoffs from the derivative, and find what the set of possible derivative prices is one period before. Given these, we can find the option one period before this again, and so on. Working ones way down to the root of the tree, the option price is found as the derivative price in the first node.

Inputs
  • Spot price: select from 33 different types of price inputs
  • Calculation Steps: how many iterations to be used in the Binomial model. In practice, this number would be anywhere from 5000 to 15000, for our purposes here, this is limited to 300
  • Strike Price: the strike price of the option you're wishing to model
  • % Implied Volatility: here you can manually enter implied volatility
  • Historical Volatility Period: the input period for historical volatility; historical volatility isn't used in the CRRBT process, this is to serve as a sort of benchmark for the implied volatility,
  • Historical Volatility Type: choose from various types of implied volatility, search my indicators for details on each of these
  • Option Base Currency: this is to calculate the risk-free rate, this is used if you wish to automatically calculate the risk-free rate instead of using the manual input. this uses the 10 year bold yield of the corresponding country
  • % Manual Risk-free Rate: here you can manually enter the risk-free rate
  • Use manual input for Risk-free Rate? : choose manual or automatic for risk-free rate
  • % Manual Yearly Dividend Yield: here you can manually enter the yearly dividend yield
  • Adjust for Dividends?: choose if you even want to use use dividends
  • Automatically Calculate Yearly Dividend Yield? choose if you want to use automatic vs manual dividend yield calculation
  • Time Now Type: choose how you want to calculate time right now, see the tool tip
  • Days in Year: choose how many days in the year, 365 for all days, 252 for trading days, etc
  • Hours Per Day: how many hours per day? 24, 8 working hours, or 6.5 trading hours
  • Expiry date settings: here you can specify the exact time the option expires

Take notes:
  • Futures don't risk free yields. If you are pricing options of futures, then the risk-free rate is zero.
  • Dividend yields are calculated using TradingView's internal dividend values
  • This indicator only works on the daily timeframe

Included
  • Option pricing panel
  • Loxx's Expanded Source Types
Release Notes:
Fixed EWMA volatility
Release Notes:
Corrected UI precision error with Risk-free rate
Release Notes:
Fixed duplicate function for HVol
Release Notes:
I changed the name of the volatility input. This is supposed to be volatility of the underlying asset, not the implied volatility of the option. You can use whatever method you wish to plug in here. I added the historical volatility for this purpose as well.
Release Notes:
Corrected error in close-to-close calculation, added Parkinson, updated UI.
Release Notes:
Corrected dividend calculation.

Public Telegram Group, t.me/algxtrading_public

VIP Membership Info: www.patreon.com/algxtrading/membership
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?