OPEN-SOURCE SCRIPT

Cumulative % Change & Inflation-Adjusted (Auto CPI by Currency)

64
This indicator tracks an asset’s cumulative performance from a user-defined start date (T0) and compares nominal returns with inflation-adjusted (“real”) returns, automatically selecting the appropriate CPI series based on the asset currency (USD or EUR).

What it shows

Nominal cumulative return (%) from T0, based on the selected price series.

Inflation change (%) from T0, using a monthly CPI index:

USD assets: US CPI (FRED CPIAUCSL)

EUR assets: Euro Area CPI (TradingView Economics EUCPI)

Real cumulative return (%) from T0, i.e., nominal return deflated by cumulative CPI.

Key inputs

T0 (start date): Year / month / day used as the reference point.

Asset currency (USD/EUR): Drives automatic CPI selection.

Initial capital: Starting value expressed in the asset’s currency; used to display current nominal and real (inflation-adjusted) portfolio value.

Performance ticker (optional): Lets you compute performance using a different symbol than the chart (e.g., a total-return series or an accumulating ETF). If left empty, the script uses the chart’s symbol.

Outputs

Plots

Nominal cumulative % change

Real (inflation-adjusted) cumulative % change

CPI % change

Summary table

Nominal return %

Real return %

CPI change %

Reference date (T0)

Initial value

Current nominal value

Current inflation-adjusted value

Performance ticker used

Notes

CPI is monthly, so the inflation line updates in steps.

If you use a price series that does not include dividends (standard “close”), nominal/real returns may underestimate total return for dividend-paying assets.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.