Generic Class Library - bugs, description, questions, usage and suggestions - page 11
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
The last example for today and apparently for this week: the correspondence between the trade number and the number of the order that triggered it:
For my case where there are more than 10,000 trades in my account, the result is as follows:
Forum on trading, automated trading systems and trading strategies testing
Generic classes library - errors, description, questions, peculiarities of use and suggestions
Vasiliy Sokolov, 2017.12.08 13:30
If N is very small, we simply normalize the number obtained by the hash function, so that it would always be in the N limit:
I've read it up to this point so far. Vasily, Thanks, everything is clear, except for the highlighted one. In my opinion, taking the remainder as a normalization is wrong. This seems more logical.
That's the thing: the size of the dictionary is often unknown. A simple example, let's say we have an Expert Advisor that trades. It tracks performed trades. When a trade appears in the history, we need to associate this trade with the EA's "Medjic". For this it is logical to use the dictionary. Where the deal number is used as a key (unique identifier), and the magic number of the Expert Advisor is used as a value. The problem is that at the start of the EA we cannot determine in advance if we will have 100 trades, 1000 or none. No matter how much memory you allocate in advance, it will still be either too little or too much.
I guess I haven't racked my brains yet. Could you please explain what you just said? I don't understand it at all.
It looks like a mockery.
HashFunction.mqh without the hook. This is not right.
What's the use of this function?
I guess I haven't completely cracked my brain. Could you clarify the highlighted? I don't understand it at all.
Personally, I understood it as follows: when making trades, the Expert Advisor should write the number of a magik in the dictionary (array) according to the number of the trade, which in this case is the index of the cell.
The number of future trades is not known in advance, and we should already have an array declared for writing the majors. The task is to allocate the necessary amount of memory for the array in advance.
It's impossible to allocate the exact amount of memory in advance. So, we could write a string of hashes, get number of substring, initialize the array and write all its substring (hashes).
Then each medjack will be accessed by trade number.
That's roughly how I see it.
The last example for today and apparently for this week: the correspondence between the trade number and the number of the order that triggered it:
For my case where there are more than 10,000 trades in my account, the result is as follows:
How much does the classical variant return in your case?
What's the use of this function?
Will not just compile for struct and union.Added another overload
Ran into.
I added one more overload.
To me, if an object doesn't implement some interface or method, it's better to explicitly generate an exception than to keep it quiet and then look for the source of the problem.
It returns negative numbers, which logically follows from this code. Is it normal?
Absolutely normal.
Hash doesn't guarantee you anything, it's just a number that characterizes this or that object to some extent.
If you need an integer, you can use uint.
As for me, if an object does not implement some interface or method, it is better to explicitly generate an exception than to keep silent and then search for the source of the problem.
MqlTick?
MqlTick?
Do you understand what the code does if there is no explicit implementation of theGetHashCode template function specialization for type T?
Answer: it's pathetic because it glosses over the problem of lack of implementation. All objects of the same class will return the same hash value.