Creating a complex calculator

Hi everyone,

I am new to Bubble and after browsing through a lot of materials I am still not able to find the most appropriate way to build my calculator.

What it does: it shows users how much they could hope to earn by investing in the stock market.

Inputs: users provide 3 inputs, their investment horizon (from 5 years up to 30 years), how much they want to invest today, how much they want to invest each month.

Output: the calculator returns 3 outputs, how much the user could have in a blue-sky scenario, how much they could have in a central scenario, and how much they could have in a grey-sky scenario.

How the output is computed: I have computed using R 1000 simulations of how the stock market could behave in the next 30 years.

I used this data to compute two numbers for each simulation and each horizon. The first number corresponds to the performance of the money invested today over the life of the investment; the second number corresponds to the performance of the money invested each month over the life of the investment.

As a result, I have two tables. The first table is formatted as follows: each line is a simulation, and each column is an investment horizon. The intersection of the two provides me, for any given simulation and any given investment horizon, the performance of the money invested today over the life of the investment.
The second table is formatted similarly, but this time, the intersection of a line and a column provides me, for any given simulation and any given investment horizon, the performance of the money invested each month over the life of the investment.

For a given simulation and a given investment horizon, the value of the portfolio is “Amount invested today” * “the performance of the money invested today over the life of the investment” + “Amount invested each month” * “the performance of the money invested each month over the life of the investment”.

For a given investment horizon, to obtain the outputs:

  1. First, I need to get the right column from the first table and the right column from the second table.
  2. Then use these columns to compute for each simulation the value of the portfolio at the end of the investment period, using the amount the user wants to invest today and the amount they want to invest each month, and the formula above.
  3. Finally, I need to rank the 1000 value I get for the value of the portfolio. The output for the blue-sky scenario will be the 100th biggest value, the central scenario will be the 500th biggest value, and the grey-sky scenario will be the 990th biggest value.

I know this is a lot to process, and I hope that this was clear.

Thank you so much in advance for the help!

This topic was automatically closed after 70 days. New replies are no longer allowed.