OPEN-SOURCE SCRIPT

ETF Builder & Backtest System [TradeDots]

326
Create, analyze, and monitor your own custom “ETF-like” portfolio directly on TradingView. This script merges up to 10 different assets with user-defined weightings into a single composite chart, allowing you to see how your personalized portfolio would have performed historically. It is an original tool designed to help traders and investors quickly gauge risk and return profiles without leaving the TradingView platform.

📝 HOW IT WORKS

1. Custom Portfolio Construction
  • Multiple Assets: Combine up to 10 different stocks, ETFs, cryptocurrencies, or other symbols.
  • User-Defined Weights: Allocate each asset a percentage weight (e.g., 15% in AAPL, 10% in MSFT, etc.).
  • Single Composite Value: The script calculates a weighted “ETF-style” price, effectively simulating a merged portfolio curve on your chart.


2. Performance Tracking & Return Analysis
  • Automatic History Capture: The indicator records each asset’s starting price when it first appears in your chosen date range.
  • Rolling Updates: As time progresses, all asset prices are continually evaluated and the portfolio value is updated in real time.
  • Buy & Hold Returns: See how each asset—and the overall portfolio—performed from the “start” date to the most recent bar.
  • Annualized Return: Automatically calculates CAGR (Compound Annual Growth Rate) to help visualize performance over varying timescales.


3. Table & Visual Output
  • Performance Table: A comprehensive table displays individual asset returns, annualized returns, and portfolio totals.
  • Normalized Chart Plot: The composite ETF value is scaled to 100 at the start date, making it easy to compare relative growth or decline.
  • Optional Time Filter: You can define a specific date range (Start/End Dates) to focus on a particular period or to limit historical data.


⚙️ KEY FEATURES

1. Flexible Asset Selection
Choose any symbols from multiple asset classes. The script will only run calculations when data is available—no need to worry about missing quotes.

2. Dynamic Table Reporting
  • Start Price for each asset
  • Percentage Weight in the portfolio
  • Total Return (%) and Annualized Return (%)


3. Simple Backtesting Logic
This script takes a straightforward Buy & Hold perspective. Once the start date is reached, the portfolio remains static until the end date, so you can quickly assess hypothetical growth.

4. Plot Customization
  • Toggle the main “ETF” plot on/off.
  • Alter the visual style for tables and text.
  • Adjust the time filter to limit or extend your performance measurement window.


🚀 HOW TO USE IT

1. Add the Script
Search for “ETF Builder & Backtest System [TradeDots]” in the Indicators & Strategies tab or manually add it to your chart after saving it in your Pine Editor.

2. Configure Inputs
  • Enable Time Filter: Choose whether to restrict the analysis to a particular date range.
  • Start & End Date: Define the period you want to measure performance over (e.g., from 2019-12-31 to 2025-01-01).
  • Assets & Weights: Enter each symbol and specify a percentage weight (up to 10 assets).
  • Display Options: Pick where you want the Table to appear and choose background/text colors.


3. Interpret the Table & Plots
  • Asset Rows: Each asset’s ticker, weighting, start price, and performance metrics.
  • ETF Total Row: Summarizes total weighting, composite starting value, and overall returns.
  • Normalized Plot: Tracks growth/decline of the combined portfolio, starting at 100 on the chart.


4. Refine Your Strategy
  • Compare how different weights or a new mix of assets would have performed over the same period.
  • Assess if certain assets contribute disproportionately to your returns or volatility.
  • Use the results to guide allocations in your real trading or paper trading accounts.


❗️LIMITATIONS

1. Buy & Hold Only
This script does not handle rebalancing or partial divestments. Once the portfolio starts, weights remain fixed throughout the chosen timeframe.

2. No Reinvestment Tracking
Dividends or other distributions are not factored into performance.

3. Data Availability
If historical data for a particular asset is unavailable on TradingView, related results may display as “N/A.”

4. Market Regimes & Volatility
Past performance does not guarantee similar future behavior. Markets can change rapidly, which may render historical backtests less predictive over time.

⚠️ RISK DISCLAIMER

Trading and investing carry significant risk and can result in financial loss. The “ETF Builder & Backtest System [TradeDots]” is provided for informational and educational purposes only. It does not constitute financial advice.
  • Always conduct your own research.
  • Use proper risk management and position sizing.
  • Past performance does not guarantee future results.
  • This script is an original creation by TradeDots, published under the Mozilla Public License 2.0.


Use this indicator as part of a broader trading or investment approach—consider fundamental and technical factors, overall market context, and personal risk tolerance. No trading tool can assure profits; exercise caution and responsibility in all financial decisions.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.