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.
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:
And many others. That's the beauty of open source!
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!
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.
Nello spirito di condivisione promosso da TradingView, l'autore (al quale vanno i nostri ringraziamenti) ha deciso di pubblicare questo script in modalità open-source, così che chiunque possa comprenderlo e testarlo. Puoi utilizzarlo gratuitamente, ma il riutilizzo del codice è subordinato al rispetto del Regolamento. Per aggiungerlo al grafico, mettilo tra i preferiti.
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.