All free tools

Trading metric

Trading Compound Calculator

Project a balance forward at a fixed return per period, with optional recurring deposits. The arithmetic is exact. Whether a fixed return per period is a realistic assumption is a separate question, and the explanation below is direct about it.

Ending balance
20,327.94
2.03x the starting balance.
Growth on money in
103.28%
Profit of 10,327.94 on 10,000.00 put in.
PeriodReturn that periodBalance
1300.0010,300.00
2309.0010,609.00
3318.2710,927.27
4327.8211,255.09
5337.6511,592.74
6347.7811,940.52
7358.2212,298.74
8368.9612,667.70
9380.0313,047.73
10391.4313,439.16
11403.1713,842.34
12415.2714,257.61
13427.7314,685.34
14440.5615,125.90
15453.7815,579.67
16467.3916,047.06
17481.4116,528.48
18495.8517,024.33
19510.7317,535.06
20526.0518,061.11
21541.8318,602.95
22558.0919,161.03
23574.8319,735.87
24592.0820,327.94

How compounding is calculated

Each period the return is applied to the current balance rather than to the original one, and the result becomes the base for the next period. That single change is the whole of compounding. Three percent on ten thousand is three hundred, and three percent on the resulting ten thousand three hundred is three hundred and nine, and the gap between those two numbers widens every period.

Written as a formula, the ending balance is the starting balance multiplied by one plus the rate, raised to the power of the number of periods. When there are deposits, each one has its own shorter compounding runway, because money added in period twenty has fewer periods left to grow than money present at the start. This calculator handles that by stepping through period by period rather than using a closed-form expression, which is also why it can show you the schedule.

The unit of a period is whatever you decide, and the only rule is that the rate has to match it. Three percent per month over twenty-four months and three percent per year over twenty-four years use identical arithmetic and describe very different things. Mixing them up, usually by taking a monthly rate and running it for a number of years, is the most common error with this kind of calculator.

What a fixed rate assumption hides

The arithmetic above is exact, and the assumption underneath it is not realistic. Returns do not arrive as a constant percentage per period, and the difference between a constant rate and a variable one that averages the same value is not a rounding detail. Variability reduces the compounded outcome, because a fall of a given percentage requires a larger percentage gain to reverse. Lose twenty percent and you need twenty-five to get back; lose fifty and you need a hundred.

That asymmetry is why a smooth projection is systematically optimistic compared with a bumpy path that has the same average. It is also why the numbers this calculator produces should be read as arithmetic rather than as a forecast. Our drawdown recovery calculator shows the asymmetry directly, and the max drawdown calculator measures how deep the declines in a real curve actually went.

The other thing a projection omits is everything that leaves the account: costs, spreads, financing, and tax. Those are subtracted from each period's return before it compounds, so their effect compounds too, in the wrong direction. If you want the projection to be closer to useful, enter a rate that is already net of them rather than adding them on afterwards.

None of this is a suggestion about what rate to use or what any account might do. It is a calculator, and putting a number into it does not make that number likely. Every decision about how to interpret the output is yours.

What are TradingView and Pine Script?

TradingView is one of the most widely used charting and market-analysis platforms, where traders and analysts study price movement across stocks, crypto, forex, and futures on interactive charts. Pine Script is TradingView's own lightweight programming language, created so anyone can build custom tools that run directly on those charts.

People use Pine Script to build four main kinds of tools. Indicators calculate and plot values on the chart, exactly like the calculation above, but recomputed automatically on every bar. Strategies add explicit entry and exit rules and can be backtested against historical data in TradingView's Strategy Tester to see how they would have behaved. Screeners scan many symbols at once for conditions you define. Alerts notify you the moment a condition you specified occurs, so you do not have to watch the screen.

The value is precision and automation. Instead of eyeballing a chart, you describe exactly what you want measured, visualized, or notified about, and TradingView runs it consistently across any market and timeframe. That is why traders, analysts, and developers write Pine Script: it turns a manual charting idea into a repeatable tool. These tools are for tracking, visualizing, and testing market ideas; they do not tell you what to trade, and that decision always remains yours.

Writing that code by hand means learning Pine Script's syntax, its type system, and the exact names of hundreds of built-in functions. It is a real programming language, and small mistakes stop a script from compiling in the Pine Editor.

Turn this into Pine Script

The interesting connection to Pine Script is that a strategy either compounds or does not, depending on one parameter. Sizing with strategy.percent_of_equity derives each position from equity as it currently stands, so results feed the next position and the curve compounds. Sizing with strategy.fixed uses the same number of units every time, so it does not.

This makes for a genuinely useful experiment. Take one set of rules, run it both ways, and compare. The list of trades will look similar because the entry and exit logic has not changed, while the equity curves can look like different strategies entirely. It is the clearest demonstration of how much of a result comes from sizing rather than from signals. Our guide to position sizing covers the three sizing methods and their tradeoffs.

Pine Script v6
//@version=6
strategy("Compounding vs fixed sizing", overlay = true,
     initial_capital     = 10000,
     // percent_of_equity is what makes a strategy compound: the size of
     // each position is derived from equity as it stands, so gains feed
     // the next position and losses shrink it.
     default_qty_type    = strategy.percent_of_equity,
     default_qty_value   = 10)

// Switch this to strategy.fixed in the declaration to compare the same
// rules without compounding. The trade list stays similar; the equity
// curve changes shape entirely.

if ta.crossover(ta.sma(close, 10), ta.sma(close, 30))
    strategy.entry("Long", strategy.long)

if ta.crossunder(ta.sma(close, 10), ta.sma(close, 30))
    strategy.close("Long")

// Equity and its starting point, so the multiple is visible on the chart.
plot(strategy.equity, "Equity")
plot(strategy.initial_capital, "Initial capital")

PineScripter is an AI built specifically for Pine Script. You describe what you want in plain English and it writes TradingView-ready v6 code. Because it is specialized on the Pine Script language and its exact function signatures, it tends to produce code that compiles far more reliably than general-purpose models like ChatGPT, which often invent functions that do not exist in Pine Script.

Related free calculators

From the blog

PineScripter is an AI developer tool that helps you write Pine Script code. It is not a financial advisor and will never offer financial, investment, or trading advice. Everything on this page, including the calculator and the explanations, is provided purely for educational and informational purposes. Any decision about how to interpret an indicator or trade a market is entirely your own. See our full disclaimer for more.