OPEN-SOURCE SCRIPT

Boyle Trinomial Options Pricing Model [Loxx]

Boyle Trinomial Options Pricing Model [Loxx] is an options pricing indicator that builds an N-order trinomial tree to price American and European options. This is different form the Binomial model in that the Binomial assumes prices can only go up and down wheres the Trinomial model assumes prices can go up, down, or sideways (shoutout to the "crab" market enjoyers). This method also allows for dividend adjustment.

The Trinomial Tree via VinegarHill Finance Labs
A two-jump process for the asset price over each discrete time step was developed in the binomial lattice. Boyle expanded this frame of reference and explored the feasibility of option valuation by allowing for an extra jump in the stochastic process. In keeping with Black Scholes, Boyle examined an asset (S) with a lognormal distribution of returns. Over a small time interval, this distribution can be approximated by a three-point jump process in such a way that the expected return on the asset is the riskless rate, and the variance of the discrete distribution is equal to the variance of the corresponding lognormal distribution. The three point jump process was introduced by Phelim Boyle (1986) as a trinomial tree to price options and the effect has been momentous in the finance literature. Perhaps shamrock mythology or the well-known ballad associated with Brendan Behan inspired the Boyle insight to include a third jump in lattice valuation. His trinomial paper has spawned a huge amount of ground breaking research. In the trinomial model, the asset price S is assumed to jump uS or mS or dS after one time period (dt = T/n), where u > m > d. Joshi (2008) point out that the trinomial model is characterized by the following five parameters: (1) the probability of an up move pu, (2) the probability of an down move pd, (3) the multiplier on the stock price for an up move u, (4) the multiplier on the stock price for a middle move m, (5) the multiplier on the stock price for a down move d. A recombining tree is computationally more efficient so we require:

ud = m*m

M = exp (r∆t),

V = exp (σ 2∆t),

dt or ∆t = T/N

where where N is the total number of steps of a trinomial tree. For a tree to be risk-neutral, the mean and variance across each time steps must be asymptotically correct. Boyle (1986) chose the parameters to be:

m = 1, u = exp(λσ√ ∆t), d = 1/u

pu =( md − M(m + d) + (M^2)*V )/ (u − d)(u − m) ,

pd =( um − M(u + m) + (M^2)*V )/ (u − d)(m − d)

Boyle suggested that the choice of value for λ should exceed 1 and the best results were obtained when λ is approximately 1.20. One approach to constructing trinomial trees is to develop two steps of a binomial in combination as a single step of a trinomial tree. This can be engineered with many binomials CRR(1979), JR(1979) and Tian (1993) where the volatility is constant.

Further reading:

A Lattice Framework for Option Pricing with Two State

Trinomial tree via wikipedia

Inputs
  • Spot price: select from 33 different types of price inputs
  • Calculation Steps: how many iterations to be used in the Trinomial model. In practice, this number would be anywhere from 5000 to 15000, for our purposes here, this is limited to 220.
  • Strike Price: the strike price of the option you're wishing to model
  • Market Price: this is the market price of the option; choose, last, bid, or ask to see different results
  • Historical Volatility Period: the input period for historical volatility ; historical volatility isn't used in the Trinomial model, this is to serve as a comparison, even though historical volatility is from price movement of the underlying asset where as implied
  • volatility is the volatility of the option
  • 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


Included
  • Option pricing panel
  • Loxx's Expanded Source Types


Related indicators
Implied Volatility Estimator using Black Scholes [Loxx]
Implied Volatility Estimator using Black Scholes [Loxx]


Cox-Ross-Rubinstein Binomial Tree Options Pricing Model [Loxx]
Cox-Ross-Rubinstein Binomial Tree Options Pricing Model [Loxx]
Release Notes
Small correction in input names.
Release Notes
Updated volatility calculations
Release Notes
Corrected dividend calculation error.
binomialblackscholesblackscholesoptionpricingboyleHistorical VolatilityimpliedvolatilityoptionsoptionspricingtrinomialVolatility

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 publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Public Telegram Group, t.me/algxtrading_public

VIP Membership Info: patreon.com/algxtrading/membership
Also on:

Disclaimer