+ Reply to Thread
Results 1 to 2 of 2

Monte Carlo Simulation

  1. #1
    Registered User
    Join Date
    03-28-2019
    Location
    Germany
    MS-Off Ver
    2016
    Posts
    16

    Monte Carlo Simulation

    Hello everybody,

    I found a Monte Carlo Simulation for Option pricing, which is relatively useful for my studying. Nevertheless, I also want to understand how this think works. And I do not get what is the purpose of the variable A and P. I'm also not really sure about this: If (j - 1) / 250 - lnt((j - 1) / 250) = 0 And j > 1 Then p = p + 1

    Could somebody explain it to me? So I'm very new into programming and this procedures so please be so kind and explain it, like you would do it to a little child :D

    Here is the Code:

    c is Call(option), S is the current Stock Price, X is the Strike Price, T is the Time, Z is the volatility, r is the risk free rate, q is the dividend, n is the number of steps
    and nlter is die number of Simulations.

    Function EuropäischeOptionMonteCalro(c As String, S As Double, x As Double, T As Double, z As Double, r As Double, q As Double, n As Double, nlter As Double) As Double

    Dim dt, e, dlns, price, SimVar(), PayVar() As Double

    ReDim SimVar(nlter, n + 1)
    ReDim PayVar(nlter)
    dt = T / n
    a = 0
    For i = 1 To nlter
    SimVar(i + a, 1) = S

    Randomize
    p = 0
    For j = 1 To n
    If (j - 1) / 250 - lnt((j - 1) / 250) = 0 And j > 1 Then p = p + 1
    e = WorksheetFunction.NormSInv(Rnd())

    dlns = (r - q - z ^ 2 / 2) * dt + z * e * dt ^ 0.5

    If j - 250 * p = 1 And p > 0 Then
    SimVar(i + p + a, 2) = SimVar(i + p - 1 + a, 251) * Exp(dlns)
    Else
    SimVar(i + p + a, j - 250 * p + 1) = SimVar(i + p + a, j - 250 * p) * Exp(dlns)

    End If

    ' Call Option oder Put Option Optionsformel
    Next j
    If c = "C" Then
    PayVar(i) = WorksheetFunction.Max(SimVar(i + p + a, j - 250 * p) - x, 0) * Exp(-r * T)
    ElseIf c = "P" Then
    PayVar(i) = WorksheetFunction.Max(x - SimVar(i + p + a, j - 250 * p), 0) * Exp(-r * T)

    End If

    a = a + p
    Next i
    price = 0
    temp = 0
    For i = 1 To nlter
    price = price + PayVar(i)

    Next i
    price = price / nlter

    EuropäischeOptionMonteCalro = price

    End Function

    Thank you very much in advance!

    Best regards
    Flappi

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,369

    Re: Monte Carlo Simulation

    This forum can be strict about rules -- like putting code into code tags. I suggest you edit your post to include the code tags (instructions are in the forum rules link at the top of the page). Then you will have a better chance of someone responding to your questions.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] Monte Carlo Simulation
    By Chanut in forum Excel General
    Replies: 4
    Last Post: 03-18-2019, 03:23 AM
  2. Monte Carlo Simulation Help
    By taylorh in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-29-2014, 01:43 PM
  3. Monte Carlo Simulation
    By TheRobsterUK in forum Excel General
    Replies: 3
    Last Post: 06-18-2014, 10:58 AM
  4. Monte Carlo Simulation
    By iamnamja in forum Excel General
    Replies: 4
    Last Post: 08-24-2011, 02:39 PM
  5. Monte Carlo Simulation
    By wmfinance in forum Excel General
    Replies: 3
    Last Post: 07-13-2010, 01:33 PM
  6. Monte Carlo simulation
    By Elijah in forum Excel General
    Replies: 9
    Last Post: 05-07-2010, 06:39 PM
  7. monte carlo simulation
    By unique in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-16-2005, 10:05 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1