OPEN-SOURCE SCRIPT

Make Your Own Index!

Updated
Intro

For my first script, I have released Make Your Own Index version 1. It has a long way to go so please stay tuned. Scroll down to read all the updates and notes as they come in.

Why it matters
Making your index is important to quickly see an index of symbols that you want to chart. Having the ability to assign weightings gives you the opportunity to make the index equal weighted or custom weighted. As we all know, indexes like the S&P 500 are NOT equal weighted, but more heavily weighted toward the winners. Now, you can make your own of a basket of symbols and make them custom weighted or equal weighted. Have some fun exploring this.

Features
You select the symbols of your choice and then chart them as one line with a specific weighting. This can be done in the settings menu once the indicator is selected. Use the symbol search field to add a symbol. From what I have tested, it works for any symbol whether it's stocks, crypto, FX and more. The default is set to stocks.

The Weight field in the settings menu is where you can assign a specific weight to the symbol of your choice. This way you can make an equal weighted index or a custom weighted index. By default each symbol is set to 10 or 10%. There are 10 symbols in the menu, so at 10%, they are equally weighted! In the script I have made it so each weighting is in percentage terms. So type in the percentage and you're good to go.

The chart is currently displayed in a separate window and not as an overlay. This may change in the future. The line can also be changed slightly and the color of it. Stay tuned for more on this.

Send in feedback
I am a Pine rookie in all regards and I am surely looking for support, feedback, and/or ideas. I want to add a lot more to this. If you look at the settings you will see have some input fields that are in their first iteration and currently needing to be improved. Rather than waiting to make them perfect, I just want to get this out there and update as I go. Also, as mentioned, I will definitely need a little support at adding more features that I have in mind.

Credit where credit is due
I used a lot of Open Source indicators as inspiration to quickly get going so thank you to the following people and accounts who share open source scripts that you can use to learn, test, and get started instantly:

TradingView
LucF
PineCoders
KioseffTrading
norok
RedKTrader
NeoButane
And many others. That's the beauty of open source!

Closing note
Publishing it open source so people can fact check my code and thinking. One thing I know for sure is that this can probably be created in a more efficient way. Nonetheless, please a take look and let me know what you think - I am excited to make some updates over the coming weeks.

Thanks for reading!
Release Notes
Update!

Special thanks to the Pine Code team - wow they are good! They helped me make sure I understood how to make the check boxes in the Index script work properly. The script will now calculate *only* the boxes you have checked in your settings menu. This means you can decide how many symbols you want to include. Check all 10 boxes to include the weights of 10 symbols or only check 3 boxes to make an index with just 3 checks.

More updates coming. Also, if you are using this tool at all, please let me know. I am curious if there is any value or certain things that need to be fixed or improved.

The comments section my pal Alex made a good observation about the weighting calculation. I will look to fix this or add it as a different option so you can decide the math of your weights.
Release Notes
Hello friends! I made this script a few years ago, for fun, and to get into Pine Script, a product I learned to love and see immense value in since I first got started at TradingView. This script, is not perfect, and I am relying on all of you to make it better. I just fixed an important update with the calculations. Please reach out to me if you want to help me improve this – I need to add a few new features. Thanks!
Release Notes
Meaningless quick update to change the default symbols: removed some inactive symbols I had as a default.
Release Notes
This script has been updated to accomplish several important goals:

1. I added a new feature that lets you show the price of every symbol in your index. So, if you wish, you can watch your index and the prices update in a table. You can toggle this on or off in the settings menu.

2. The colors of the line have been updated to give you all more ways to view the index you create. You can also toggle on gradients if you wish to make more colors and specifically show down moves and up moves based on the color of your choice.

3. I changed some of the text in the Settings menu to make it a little easier to read and specifically adding the % character to remind people that weights are percentage based. Here is where you add a percentage weight to each symbol. Remember to ensure it sums up to 100% or if you're using leverage, it could go beyond 100%.

I have more work to do and want to create more capabilities around indexing and your various comments & questions. Some of it is beyond my skills! Please reach out if you have feedback on how to make this Pine Script smoother with new capabilities.
Fundamental AnalysisindexesindextradingPortfolio managementsentiment

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in publication is governed by House rules. You can favorite it to use it on a chart.

Want to use this script on a chart?


Leading TradingView's educational videos on Youtube: youtube.com/channel/UCfOflihrkOKDQZ_ZKtF2VfQ

Read my blog here: scheplick.com

Follow me on X here: x.com/scheplick
Also on:

Disclaimer