
In this article, we will talk about the Equal Weighted Index. This is when, using multipliers multiplied by price, the weight of each security in the index is equalized. In OsEngine, this type of weighting can be created in just a few clicks with recalculations once an hour, day, or week for any securities available from your broker.
1. Calculation of the Equal Weighted Index.

When the index is recalculated, we select multipliers for its price so that the share of each security is equal. In this case, it would be 25% each if we have four securities. The logic is as follows:
1. For the most expensive security, we take a multiplier of 1. This security will serve as the benchmark.
2. For the other securities, we select multipliers so that they currently have the same weight as security 1.
3. Add up the final values.
2. How to enable an Equal Weighted Index through the auto formula in OsEngine.
In the index settings window, select the desired weighting type - Equal Weighted:

This is how the price-weighted index formula looks.
As a result, you get a candlestick chart of the index, on which you can add any indicators available in OsEngine and receive trading signals from it.

3. Source code.
Index weighting is done in the BotTabIndex file, in the IndexFormulaBuilder class:
https://github.com/AlexWan/OsEngine
In the method:

The logic is broken down into different weighting types by methods.
* If you find any mistakes in the source code, be sure to contact support.
https://t.me/osengine_official_support
Good luck with algorithms!