Consulting

Results 1 to 6 of 6

Thread: Error #Value!, vba code trinomial model, Option Put American

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Exclamation Error #Value!, vba code trinomial model, Option Put American

    I am trying to calculate the PUT PRICE but I am getting error Value. This is the code :

    [CODE
    Function Mon_AmericanPut_Trinomial(S, X, T, rf, sigma, n)
    delta_t = T / n
    up = Exp(sigma * Sqr(3 * delta_t))
    down = 1 / up
    r = Exp(rf * delta_t)
    Pu = (r - down) / (up - down)
    Pd = (up - r) / (up - down)
    Pm = 1 - Pu - Pd
    Dim Prix_t_plus_1() As Double
    Dim Prix_t() As Double
    ReDim Prix_t_plus_1(n)
    For State = 0 To n
    Prix_t_plus_1(State) = Application.Max(X - S * _
    up ^ State * down ^ (n - State), 0)
    Next State
    For Index = n - 1 To 0 Step -1
    ReDim Prix_t(Index)
    For State = 0 To Index
    Prix_t(State) = Application.Max(X - S * up ^ State * down ^ (Index - State), _
    (r) ^ (-1) * ((Pd) * Prix_t_plus_1(State) + (Pm) * Prix_t_plus_1(State + 1) + (Pu) * Prix_t_plus_1(State + 2)))
    Next State
    ReDim Prix_t_plus_1(Index)
    For State = 0 To Index
    Prix_t_plus_1(State) = Prix_t(State)
    Next State
    Next Index
    Mon_AmericanPut_Trinomial = Prix_t(0)
    End Function
    [/CODE]
    Last edited by Aussiebear; 04-16-2023 at 04:16 PM. Reason: Reduced the whitespace

Posting Permissions

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