OPEN-SOURCE SCRIPT
Atualizado

Custom Index Composite

135
Custom Index Composite calculates an unweighted composite index by averaging the daily returns of multiple stock tickers. Instead of using price-level weighting, it focuses solely on percentage change, allowing you to compare diverse market themes side by side on a common basis.


Why Use a Custom Index Composite?

Unlike traditional indices that often lean on market capitalization or price-level data, a custom composite based solely on returns strips out the bias inherent to high-priced stocks. This provides several benefits:

  • Objective Cross-Comparison:
    When stocks or market themes trade at very different price levels, it can be difficult to assess performance objectively. Using percentage returns, the composite creates an even playing field, enabling a clear comparison between different assets or themes.

  • Tailored Benchmarking:
    By selecting and combining specific tickers, you can create benchmarks that better represent the segments or strategies you’re interested in. This is particularly useful when standard indices do not capture the nuances of your investment approach.

  • Performance Normalization:
    Converting raw price data into daily percentage returns minimizes distortions that arise from price differences. This normalization helps in understanding true performance trends across the chosen tickers, making the composite index a more reliable gauge of relative market movement.

  • Custom Analysis Framework:
    The indicator offers flexibility to adjust the lookback period (defaulting to about 3 months) so you can fine-tune the sensitivity of the index to recent market behavior. This enables you to either smooth out volatility or capture a more immediate trend, depending on your analytical needs.



Key Features:

  • Configurable Appearance:
    You can easily configure the line color, line width, index name, and index name color via the options panel.
  • Ticker Configuration:
    By default, you can enter up to 15 different tickers into the composite index. Technically, the indicator supports up to 40 tickers (these additional inputs are commented out by default to maintain performance), and you may enable them individually if required.
  • Calculated Bars Length:
    The indicator uses a “Calculated bars length” setting, which is set by default to 63 days (approximately 3 months). This value can be adjusted, and it is recommended to use the greatest common denominator for consistent analysis.



How To Configure Your Chart:

  1. Add the Indicator:
    Place the Custom Index Composite on your chart.
  2. Disable Main Symbol Visibility:
    Hide the primary symbol’s plot and set its scale to “None” to prevent interference with the composite display.
  3. Pin to Right Scale:
    Set the scale of the first composite indicator to “Pinned to right scale.” This helps maintain consistency across different composite indicators.
  4. Add Multiple Composites:
    You can add additional composite indicators and set their scales to “Pinned to right scale” (or alternatively to “A”) for convenient comparison.


Limitations:

If a ticker symbol is set once in the options, it cannot be cleared to an empty value later. As a result, the symbol will continue to appear in the indicator’s title on the chart. The only way to remove an unwanted symbol is to completely reset the settings and re-enter your desired tickers.
Notas de Lançamento
Chart Update (cleaner version and typo fixed)

Aviso legal

As informações e publicações não devem ser e não constituem conselhos ou recomendações financeiras, de investimento, de negociação ou de qualquer outro tipo, fornecidas ou endossadas pela TradingView. Leia mais em Termos de uso.