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

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.
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.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.
Script de código aberto
Em verdadeiro espírito do TradingView, o criador deste script o tornou de código aberto, para que os traders possam revisar e verificar sua funcionalidade. Parabéns ao autor! Embora você possa usá-lo gratuitamente, lembre-se de que a republicação do código está sujeita às nossas Regras da Casa.
Aviso legal
As informações e publicações não se destinam a ser, e não constituem, conselhos ou recomendações financeiras, de investimento, comerciais ou de outro tipo fornecidos ou endossados pela TradingView. Leia mais nos Termos de Uso.