296 views

Uploaded by rndomperson

Numerical optimisation methods using Excel VBA.

- MTools v1.09 for Excel 2007-2013
- project 3 - grade book
- Siebel Testing
- Splitup of Sem1
- Newton-Raphson Method in Excel VBA
- Design a VBA User Form - Option Buttons, Command Buttons, Picture Boxes
- 2010 11Annual Report
- Heyebook
- VBA_Training_Document.pdf
- Release Notes Safe 2014 v 1420
- Fundamentals of Electricity Derivatives
- During the Previous Spring Semester To
- Create PowerPoint Presentations Automatically Using VBA _ Chandoo.org - Learn Microsoft Excel Online
- GL Budgeting Process
- Big Er Hull 1983
- Microsoft Excel Presentation 17558
- Locals to Chas Tic Jump Diffusion
- Trainer Credentials - S M Sumsul Islam
- EXLerate Reference Manual I
- abc

You are on page 1of 4

Newtons Algorithm

Newton's algorithm, alternately called the Newton-Raphson method, is a numerical method for solving equations of the type f(x)=0. It has numerous applications in finance, and we will use it to determine the volatility surface for a call option using the Black Scholes VBA function. The method applies when we have a close approximation for a solution to the equation. The method assumes that the tangent to the graph at our approximation intersects the x-axis closer to the solution of the equation, i.e. closer to where the line we are evaluating intersects the x-axis. By solving for where the tangent intersects the xaxis, and repeating the process from that point, we get closer and closer to the actual solution of the equation. Let's say we're at our approximate solution, x0. The value of y-axis at this point is y = f(x0). We know that the tangent has gradient f'(x) - the same gradient as the line, from the definition of a tangent. We also know that a univariate linear function takes the form f(x) = mx + c, where m is the gradient, x is the horizontal displacement from the starting point, and c is the vertical displacement from the starting point. As such, we have y = f'(x0)(x-x0) + f(x0) as the line of the tangent. We solve this for y = 0 in order to get the next guesstimate of the solution to f(x) = 0. The above is the simpler method of interpretation, but the statement f(x) = mx+c is actually derived from the more generalised Taylor's series expansion where a continuous, differentiable function f may be expanded about a point c as follows: f(x) =f(c)+f'(c)(x-c)+f''(c)/2!*(xc)^2+... This is the univariate version of the Taylor expansion, but it will suffice for finding, for example, volatility smiles since we assume that all other variables remain constant. Since the equation is linear, no second order derivatives exist so these fall away, leaving f(x) =f(c)+f'(c)(x-c). In our example, x0=c, giving y = f'(x0)(x-x0) + f(x0) The equation of the intersection of the tangent with the y-axis is given by the following: 0 = f'(x0)(x1-x0) + f(x0) We then solve for x1 x1 = x0 - (f(x0)/f'(x0) From this we can induce (though actual proof is out of scope here), that xn+1 = xn - f(xn)/f'(xn) , which is the formula for Newton's method. The formula for Newton's method works in cases where the function is differentiable, and where the gradient is not equal to zero.

VBA implementation of Newton's algorithm

Here is an implementation of Newton's algorithm for a simple function, f(x) = x2 - 3. For the volatility surface version, func(x_n) will be replaced by the Black Scholes VBA pricing function, and func_dash(x_n) will be replaced by the VBA function for calculating vega, the first derivative of the option price with respect to volatility. Function Newton(Seed As Double, Precision As Double) As Double Dim x_next As Double, x_n As Double, error_val As Double Dim ctr As Integer x_n = Seed ctr = 0 Do x_next = x_n - func(x_n) / func_dash(x_n) error_val = x_next - x_n x_n = x_next ctr = ctr + 1 Loop Until (Abs(error_val) <= Precision Or ctr = 1000) Newton = x_next End Function Function func(x_n) As Double func = x_n ^ 2 - 3 End Function Function func_dash(x_n) As Double func_dash = 2 * x_n End Function

You can get complete Excel apps from VBA Develeoper.net containing the code in this document, customisation, VBA development of any Excel, Access and Outlook apps, as well as C# and C++ add-ins and technical documentation.

How to build a Black Scholes VBA Option Pricer

How to build a Black Scholes C# Option Pricer How to build a Black Scholes VBA Option Pricer for FX Options How to build a Black Scholes VBA Option Pricer for Equity Options How to build a Black Scholes VBA Option Pricer using Monte Carlo Simulation How to build a Black Scholes VBA Option Pricer for Binary Options How to build a Black Scholes VBA Option Pricer for Equity Barrier Options How to build a Black Scholes VBA Option Pricer for Exotic Asian Options How to build a Black Scholes VBA Option Pricer for Exotic Lookback Options How to build an Equity Option Pricer using the Binomial Tree in Excel VBA How to code a Choleskey Decomposition in VBA (Numerical Methods for Excel) 3 ways to sort in VBA How to Code a Multivariate Value at Risk (VaR) VBA Monte Carlo Simulation How To Code the Newton-Raphson Method in Excel VBA How to Model Volatility Smiles, Volatility Term Structure and the Volatility Surface in Excel VBA How To Write Use Cases for a Portfolio Reporting VBA Tool How To Write a User Interface Model For a Portfolio Reporting VBA Tool How To Create a Semantic Object Model For a Portfolio Reporting VBA Tool How To Normalise a Database For VBA Apps How To Create a Database using SQL Scripts for a Portfolio Reporting VBA App How to Write Stored Procedures in SQL/Access/VBA for a Portfolio Reporting VBA App How to Use Cursors in SQL for a Portfolio Reporting VBA Tool How to Move Data from Access to Excel with SQL for a Portfolio Reporting VBA App

Portfolio Reporting VBA Tool: Inserting Data into SQL/Access Databases from Excel Portfolio Reporting VBA Tool: Connecting Excel with SQL & Access Databases How To Design Classes For an Option Pricer in VBA: UML Concepts How To Design Classes for Object Orientated VBA Programming

- MTools v1.09 for Excel 2007-2013Uploaded bygverma
- project 3 - grade bookUploaded byapi-244997961
- Siebel TestingUploaded bySreeharshavardhanreddy Minammareddy
- Splitup of Sem1Uploaded byJyotiKalsaria
- Newton-Raphson Method in Excel VBAUploaded byMagno Felipe Teixeira
- Design a VBA User Form - Option Buttons, Command Buttons, Picture BoxesUploaded byReaper's Scythe
- 2010 11Annual ReportUploaded bysamgmg
- HeyebookUploaded bygerte_yuew
- VBA_Training_Document.pdfUploaded byJack Desouza
- Release Notes Safe 2014 v 1420Uploaded byNick Bester
- Fundamentals of Electricity DerivativesUploaded byFrancisco José Murias Dominguez
- During the Previous Spring Semester ToUploaded bygerte_yuew
- Create PowerPoint Presentations Automatically Using VBA _ Chandoo.org - Learn Microsoft Excel OnlineUploaded byGénesis Del Carmen
- GL Budgeting ProcessUploaded byspondugula
- Big Er Hull 1983Uploaded byUzair Umair
- Microsoft Excel Presentation 17558Uploaded byamitarya514
- Locals to Chas Tic Jump DiffusionUploaded bygarycwk
- Trainer Credentials - S M Sumsul IslamUploaded byLony
- EXLerate Reference Manual IUploaded byMisbah El Munir
- abcUploaded bytbijle
- Bond Valuation and Pricing of Interest Rate Options in IndiaUploaded bySumit Bhartia
- Perkiraan ArusUploaded bymof98009
- Teaching Excel 1627Uploaded byFazal Khan
- microsoft excelUploaded byspirit571
- l7 - work scenarioUploaded byapi-463766155
- American Options v2Uploaded byfatcode27
- dictaat.pdfUploaded byGisselaPozo
- Excel Spreadsheet to PDFUploaded byKristin
- index of SAP FM'sUploaded byAnonymous zWS4U8N
- BlastQuarter_03Uploaded byAndy Rivera

- IMS SimCAT-15 (2014) #Quant OnlyUploaded bySudhanshu Jaiswal
- 264Uploaded bySuraj Dahal
- Problem Set 2013Uploaded byAlejandro Sazo Gómez
- MTE-10Uploaded byVipin
- Surface Design IN VATIA V5Uploaded byspsharmagn
- 1995 Sartori Geometric Error CompensationUploaded byeholmes80
- Unit-7 General SeriesUploaded byChandradeep Reddy Teegala
- Differential EquationsUploaded bysreekantha
- Griffiths Errata.. Introduction to quantum mechanics, 1st ed. (2000) 1995Uploaded byrafael_pazin5105
- 2.12.pdfUploaded byRachel Watson
- november news 2014Uploaded byapi-263076931
- IRJET-Solving Quadratic Equations using C++ Application ProgramUploaded byIRJET Journal
- 7thgradeintegertimelineproject.docUploaded byMelissa
- TrigonometryUploaded byaintenough
- euclid.chmm.1263838625Uploaded byGurprit singh
- An Introduction to Legal LogicUploaded byAnnamaAnnama
- capitulo 1Uploaded bycbobandor
- met labUploaded byChristian Yuca
- Mathematics 1980 Paper 2Uploaded byapi-3826629
- The Mathematical Magic of the Fibonacci NumbersUploaded bytpet
- Total Surface Area Lesson PlanUploaded byJonathan Robinson
- Quad Forms MatricesUploaded byJessica Henderson
- Vibrations of a Composite Beam Under Thermal and MechanicalUploaded byÁlvaro Peres
- course iUploaded byNairah Mohamed
- c++ ProgramsUploaded bySugandh Gupta
- Combinatorics Problem Set 1Uploaded byValer Olimpiu Șuteu
- Signals and Systems- Unit -iUploaded byohmshankar
- Process.Dynamics.and.Control.Seborg.2nd.Ch06.pdfUploaded byUtkarsh Jain
- Straight+Lines+OKUploaded byapi-3728411
- Dieter R. Brill- Multi-Black-Holes in 3D and 4D anti-de Sitter SpacetimesUploaded byDex30KM