Make Your Own Index for Investors by Stef

I’m excited to introduce my first script, “Make Your Own Index” which I coded in Pine Script and on TradingView. This tool allows you to create a custom index of symbols with specific weightings. It’s an essential tool for traders looking to quickly visualize an index of their chosen symbols, whether they want an equal-weighted or custom-weighted index. Stay tuned for updates as I continue to improve and enhance this script.

Why It Matters

Creating your own index is crucial for quickly analyzing a basket of symbols you want to chart. Traditional indexes like the S&P 500 are not equally weighted; they favor the winners more heavily. With this script, you can create a custom index of any symbols and assign your own weightings, allowing for equal-weighted or custom-weighted indexes. It’s a fun and insightful way to explore the performance of a selected group of assets.

Key Features

  1. Custom Symbol Selection: Choose the symbols you want to include in your index. The script supports various asset types, including stocks, crypto, and FX. The default setting is stocks.
  2. Custom Weighting: Assign specific weights to each symbol in the settings menu. By default, each symbol is set to 10%, making the index equally weighted if you select 10 symbols. Adjust the weights as needed to create your custom index.
  3. Separate Chart Display: The index is currently displayed in a separate window, not as an overlay. This may change in future updates. You can also customize the line color.
  4. User-Friendly Settings: The settings menu allows you to add symbols, adjust weights, and tweak other settings easily. The weights are in percentage terms, making it straightforward to assign and adjust.
  5. Checkbox Functionality: Now, the script calculates the index based on the symbols you check in the settings menu. You can include the weights of up to 10 symbols or just a few, depending on your selection.
  6. Symbol Price Display: Added a feature to show the price of every symbol in your index in a table. You can toggle this on or off in the settings menu.
  7. Line Color Customization: Updated the line colors to provide more viewing options. You can also enable gradients to highlight up and down moves based on your chosen colors.
  8. Settings Menu Improvement: Improved readability of the settings menu and added the “%” character to remind users that weights are percentage-based. Ensure the weights sum up to 100% or, if you’re using leverage, they can go beyond 100%.

Seeking Feedback and Collaboration

As a Pine Script rookie, I’m looking for support, feedback, and ideas to make this script even better. The settings menu includes input fields in their first iteration that need improvement. Rather than waiting for perfection, I’m releasing this version to gather feedback and make updates as I go. If you have suggestions or want to help add new features, please reach out.

Credit Where Credit Is Due

I drew inspiration from various open-source indicators to get started quickly. Special thanks to the following people and accounts for sharing their open-source scripts:

  • TradingView
  • LucF
  • PineCoders
  • KioseffTrading
  • norok
  • RedKTrader
  • NeoButane
  • And many others

The open-source community has been incredibly helpful, and I’m grateful for their contributions.

Closing Note

I’ve published this script as open source so everyone can review and improve the code. I know it can be made more efficient, so please take a look and share your thoughts. I’m excited to make updates and enhancements in the coming weeks.

Thank you for reading! I look forward to your feedback and support.


I appreciate all the help from the Pine Coders team. They assisted me in understanding how to make the checkboxes in the Index script work properly. Now, you can decide how many symbols to include in your index by checking the relevant boxes in the settings menu.

I’ve made an important update to the calculation methods based on user feedback, including a suggestion from my friend Alex about the weighting calculation. I fixed this and added it as a different option so you can decide the math of your weights.

Lastly, I made a quick update to change the default symbols, removing some inactive ones, and added a new feature to show the price of every symbol in your index in a table, with customizable line colors and gradients.

More updates and features are on the way. If you have any feedback or ideas, please reach out. Let’s make this tool even better together!

Get it here: https://www.tradingview.com/script/zvI4wFIE-Make-Your-Own-Index/