Dollar-Cost Averaging Calculator Formula

Understand the math behind the dollar-cost averaging calculator. Each variable explained with a worked example.

Formulas Used

Future Value

future_value = monthly_return > 0 ? monthly_investment * (pow(1 + monthly_return, total_months) - 1) / monthly_return : total_invested

Total Invested

amount_invested = total_invested

Investment Gains

investment_gains = (monthly_return > 0 ? monthly_investment * (pow(1 + monthly_return, total_months) - 1) / monthly_return : total_invested) - total_invested

Total Gain

gain_percentage = total_invested > 0 ? ((monthly_return > 0 ? monthly_investment * (pow(1 + monthly_return, total_months) - 1) / monthly_return : total_invested) - total_invested) / total_invested * 100 : 0

Variables

VariableDescriptionDefault
monthly_investmentMonthly Investment(USD)500
yearsInvestment Period(years)10
annual_returnExpected Annual Return(%)8
monthly_returnDerived value= annual_return / 12 / 100calculated
total_monthsDerived value= years * 12calculated
total_investedDerived value= monthly_investment * total_monthscalculated

How It Works

Dollar-Cost Averaging (DCA)

DCA involves investing a fixed amount at regular intervals, regardless of market conditions.

How DCA Works

  • When prices are high, your fixed amount buys fewer shares
  • When prices are low, your fixed amount buys more shares
  • Over time, your average cost per share smooths out
  • Future Value Formula

    FV = PMT x [(1+r)^n - 1] / r

    Where PMT is the monthly investment, r is the monthly return, and n is total months.

    DCA vs Lump Sum

    Historically, lump-sum investing outperforms DCA about 2/3 of the time. However, DCA reduces the emotional risk of investing at a peak and is the natural approach for income earners.

    Worked Example

    $500/month for 10 years at 8% annual return.

    monthly_investment = 500years = 10annual_return = 8
    1. 01Monthly return = 8% / 12 = 0.667%
    2. 02Total months = 120
    3. 03Total invested = $500 x 120 = $60,000
    4. 04Future value = $500 x [(1.00667)^120 - 1] / 0.00667 = $91,473
    5. 05Investment gains = $91,473 - $60,000 = $31,473

    Ready to run the numbers?

    Open Dollar-Cost Averaging Calculator