Remember that, although the instance_bit variable has 64 bits, only 53 bits can actually be used due to the conversion to the double type when assigning to the global variable. Therefore, the maximum number of instances that can be managed through a global variable, which is of the double type in MQL5, is 53.
Uses 1 temporary GV and bitwise operators.
Uses 1 temporary GV and bitwise operators.
Nice variation on the bitwise methodology. Slightly quicker too, I imagine
Using the previous ideas, I implemented the two functions below with some modifications to the code in MQL5:
Here is an example of how to use these functions to create a unique ID in the name of an indicator:
Complement to: https://www.mql5.com/en/forum/191997/page3#comment_54114970
Remember that, although the instance_bit variable has 64 bits, only 53 bits can actually be used due to the conversion to the double type when assigning to the global variable. Therefore, the maximum number of instances that can be managed through a global variable, which is of the double type in MQL5, is 53.