# BarrierMC: Barrier option valuation via Monte Carlo (MC) simulation. In QFRM: Pricing of Vanilla and Exotic Option Contracts

## Description

Calculates the price of a Barrier Option using 10000 Monte Carlo simulations. The helper function BarrierCal() aims to calculate expected payout for each stock prices.

Important Assumptions: The option follows a General Brownian Motion (GBM) ds = mu * S * dt + sqrt(vol) * S * dW where dW ~ N(0,1). The value of mu (the expected percent price increase) is assumed to be `o\$r-o\$q`.

## Usage

 ```1 2``` ```BarrierMC(o = OptPx(o = Opt(Style = "Barrier")), knock = c("In", "Out"), B = 60, NPaths = 5) ```

## Arguments

 `o` The `OptPx` Barrier option to price. `knock` Defines the Barrier option to be "`In`" or "`Out`" `B` The Barrier price level `NPaths` The number of simulation paths to use in calculating the price

## Value

The option `o` with the price in the field `PxMC` based on MC simulations and the Barrier option properties set by the users themselves

## Author(s)

Huang Jiayao, Risk Management and Business Intelligence at Hong Kong University of Science and Technology, Exchange student at Rice University, Spring 2015

## References

Hull, John C., Options, Futures and Other Derivatives, 9ed, 2014. Prentice Hall. ISBN 978-0-13-345631-8, http://www-2.rotman.utoronto.ca/~hull/ofod/index.html. Also, http://stackoverflow.com/questions/25946852/r-monte-carlo-simulation-price-path-converging-volatility-issue

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10``` ```(o = BarrierMC())\$PxMC #Price =~ \$11 o = OptPx(o=Opt(Style='Barrier'),NSteps = 10) (o = BarrierMC(o))\$PxMC #Price =~ \$14.1 (o = BarrierMC(NPaths = 5))\$PxMC # Price =~ \$11 (o = BarrierMC(B=65))\$PxMC # Price =~ \$10 (o = BarrierMC(knock="Out"))\$PxMC #Price =~ \$1 ```

### Example output

``` 7.288736
 6.73134
 16.39553
 5.474722
 0.1317789
```

QFRM documentation built on May 2, 2019, 8:26 a.m.