Example Code

Retirement Calculator w/ Market Volatility

Code and Documents

Attachment

Overview

Calculator to model the influence of market volatility on retirement goals.

Description

Calculator pseudo-randomly generates annual return based on stated return target and historical deviation in the equity and bond market.  Probability that your retirement goal will be achieved is estimated using the annual return generated by the calculator along with other retirement planning variables, such as current savings, current compensation, future earning potential, inflation, savings rates, current age, retirement age, life expectancy, and retirement costs.  Number of simulations to be run by the calculator can be selected. Lower values allow for the effect of market varation to be visualized while higher values allow for better statistics.  Histograms for yearly returns, average savings balance, and savings balance at time of death for each simulation can be outputed.  Raw data, such as retirement savings balance, investment returns, savings contributions, and savings withdraws per year, can be viewed in the program itself and/or exported to a text file.

Steps to Implement or Execute Code

  1. Open program.
  2. Press play button.
  3. Change variables to match your retirment plan.  Descriptions for the variables can be located in the tip strip.
  4. Calculator will execute each time a variable is changed.
  5. Select if you would like the data plotted in the program itself and/or exported to a text file.  Detailed results from simulator are located on the tabs.
  6. Press the stop button to stop the calculator.

Requirements

Software LabVIEW 8.5.1 or later.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors