
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Yes. I think we can do without hash in this case. I was too hasty with my advice about hashes. :)
If this option will suit Vasily - we will simply put all parameters into string. The string will be identifier of the class.
But it is correct too. After all, in this case crypto protection is not needed at all. The bad thing, however, is that you still need to convert the string of all parameters into a specific, preferably 32-bit unique number, and for that you probably will need to use hash functions.
Hell, there are no bitwise operators like inversion, offset, etc. in MQL. Yeah, it's a bit hard to do all that in MQL.
Yes. In this case we can do without hash.
If this variant suits Vasiliy, then we just put all parameters into string. The string will be the class identifier.
Like... matching hash -> sorted set -> elements...
The main thing is that a sorted list is associated with the hash.
.
Then everything will also "fly" (though, low and low...).
Problem: you need to uniquely identify an instance of a class by its unique ID, preferably of long type. The unique ID should be formed considering uniqueness of values of variables belonging to the class.
Geez! I'll have the same task on Monday )))).
I won't be able to use a string, as I'm limited by length - I'll need to name objects based on it.
I was thinking... You can probably use two hashing algorithms at the same time - it will greatly reduce the probability of non-uniqueness... or am I mistaken?
Hell, MQL doesn't have bitwise operators like inversion, offset, etc. Yeah, it's going to be hard to do all that in MQL.
Why not? It's all there! https://docs.mql4.com/ru/basis/operations/bit
Hell, MQL doesn't have bitwise operators like inversion, offset, etc. Yes, it would be hard to do all that in MQL.
Shift the binary representation of y to the left by x bit y <<= x;
Bitwise AND operation of binary representations of y and x y &= x;
Bitwise OR of binary representations y and x y |= x;
Bitwise exclusive OR operation
of binary representations y and x y ^= x;
Maybe y != x; works too
SZY: about uniqueness of names etc. - the problem, as always, comes down to the old problem: how to save memory and not lose performance
either use an array of strings with unique names and thus increase the amount of data, or use a function that will use an algorithm based on the input data to form a unique name, thereby reducing performance but saving memory
https://docs.mql4.com/ru/basis/operations/assignвозможно and y != x; works
not there.
but here https://docs.mql4.com/ru/basis/operations/bit
not there.
but here https://docs.mql4.com/ru/basis/operations/bit
not there! ;)
SZY: this information is the same, just the example for both assignment and bitwise operations is the same, because my link says "Bitwise operations are performed only with integers", if you want I can tell you the exact link ;), I think C-4 will understand where and where to read the Help
Here is a working example of Adler32 hash function:
The basic code of the function is taken from wikipedia and slightly modified for MQL5. Here is the result of the script work:
2011.01.22 22:50:10 BitOperations (#MCD,MN1) 2333149633
2011.01.22 22:50:10 BitOperations (#MCD,MN1) 2169506126
2011.01.22 22:50:10 BitOperations (#MCD,MN1) 1202325230
As you can see all values returned by this function are absolutely different, though strings themselves are not very different.
Here is a working example of Adler32 hash function:
The basic code of the function is taken from wikipedia and slightly modified for MQL5. Here is the result of the script work:
As you can see all values returned by this function are absolutely different, though strings themselves are not very different.
great.
if you can (so as not to lose it) drop it in the MQL5 codebase.
great.
if you can (so as not to lose it) drop it in the MQL5 codebase.
Okie.