Errors, bugs, questions - page 1676

 

Gentlemen, how to declare a function in MKL that takes a pointer (reference in µl) to anything (analogous to void* in C/C++ )? I don't mean cast by genealogical tree, but cast by unrelated types. At least take an array of any type.

void f(... &...) {}

void mql_main()
{
  int i[2];
  double d[2];
  f(i);
  f(d);
}
I understand all the difficulties relating to "type aliasing" and compiler's optimizations.
 
pavlick_:

Gentlemen, how to declare a function in MKL that takes a pointer (reference in µl) to anything (analogous to void* in C/C++ )? I don't mean cast by genealogical tree, but cast by unrelated types. At least take an array of any type.

I understand all the difficulties relating to "type aliasing" and compiler's optimizations.
I think that what you want to do, you can do only through the class methods in MQL5. Although, I'm waiting for more answers, I don't have much experience in it.
 
pavlick_:

Gentlemen, how to declare a function in MKL that takes a pointer (reference in µl) to anything (analogous to void* in C/C++ )? I don't mean cast by genealogical tree, but cast by unrelated types. At least take an array of any type.

All the rags concerning "type aliasing" and compiler's optimizations I understand.

Well, they've already added void * pointers, don't they? Besides, you can use templates, like

template<typename T>

void f(T &parameter)

{

 
Stanislav Korotky:

It's like they've already added void * pointers. Besides, you can use templates, like

template<typename T>

void f(T &parameter)

{

MKL pointers (descriptors) immediately fall away. The problem was in the declaration of the function imported from dll, templates cannot be bitten there. I found that you can do it this way:

#import ...
  int send(..., char &buf[], ...);
  int send(..., short &buf[], ...);
#import
And everything will be linked to a single function. That solves my problem. Thanks to those who responded for the answer.
 
Itum:
Please tell me how to find the maximum drawdown in Excel... Give me the formula...
If as in the equity tester, it is difficult in Excel, because the tester takes into account not only the negative deviation, but also the positive deviation - the under-received potential profit.
 
-Aleks-:
If as in the equity tester, it is complicated in Excel, because the tester takes into account not only the negative deviation, but also the positive deviation - the under-received potential profit.
There is nothing complicated there. The first column represents equity values, the second column represents the maximum equity value from the first to the current row and the third column represents the drawdown, the difference between the second and the first columns. And then take the maximum from the third column.
 
Sergei Vladimirov:
There is nothing complicated there. The first column shows equity values, the second column shows maximum equity from the first to the current row, and the third column shows the drawdown, the difference between the second and first columns. Well, take the maximum from the third column.
Such calculations will not fit the tester data. We have to consider the change in equity between opening and closing of the position as the maximum change in equity has to be entered in a separate column and the module has to be considered and then the maximum has to be chosen from this column. This is profitable trading, otherwise it is necessary to identify the maximum equity profit point and make calculations on it....
 
-Aleks-:
Such calculations will not correspond with the tester's data. It is necessary to consider the change in equity between opening and closing of the position - the maximum change in equity has to be placed in a separate column and the module has to be considered, and then the maximum has to be selected from this column. This is relevant to profitable trading while in the opposite case we have to define the maximum profit point by equity and make calculations on it.....
What does the tester have to do with it? The question was about Excel. I do not understand why it is important to deal with it in this thread. In essence no module is needed, the drawdown = last max minus current value, the result will always be non-negative. Or vice versa, current value minus last maximum, then the result will always be negative or zero. In the first case take the maximum of the column, in the second take the minimum.
 
Sergei Vladimirov:
What does this have to do with the tester? The question was about Excel. It's just not clear why it's in this thread. In essence - no module is needed, drawdown = last max minus current value, the result will always be non-negative. Or vice versa, current value minus last maximum, then it will always be negative or zero. In the first case take the maximum of the column, in the second take the minimum.
Drawdown in the tester = maximum - minimum, it does not matter at what point the position was closed. In other words, if the position goes in your direction at the beginning, and then closes in the opposite direction, the equity drawdown is the section from the maximum to the minimum, and not from the opening price to the closing price. This is the case in MT4.
 
-Aleks-:
Drawdown in the tester = maximum - minimum, it does not matter at what point the position was closed. In other words, if the position started out going in your direction, but was closed in the opposite direction, the equity drawdown is the section from the maximum to the minimum, and not from the opening price to the closing of the position. That is the case in MT4.
I did not write anything about opening and closing prices.
Reason: