Is it possible to pass an array to a function that does not start with a zero element? For example, as a reference to the i-th element, and how would that look?
fellow: Is it possible to pass an array to a function that doesn't start with a zero element? For example, as a reference to the i-th element, and how would this look?
fellow: is it possible to pass an array to a function that doesn't start with a zero element? For example, as a reference to the i-th element, and how would that look?
You do not declare an array in the function import, but a simple reference.
When calling the function, pass in the i-th element of the array as a parameter. If you want an array from the beginning, pass in the 0th element of the array as a parameter.
Approximately like this:
#import "MyDLL.dll"void MyFunc(int& par1, int size);
#import
...
int IntArray[100];
int i;
...
MyFunc(IntArray[0],100);
...
i=55;
MyFunc(IntArray[i],ArraySize(IntArray)-i);
...
A word of advice to a very novice))). The question is as follows:
Let's assume a position was opened by a price jump and an ascending MA (it was set in the code), but almost immediately the chart changed, that is, the MA started going down (as well as the entire chart of course)) ). I have to write a function that will close the position at this point, but I have not reached stop loss or limit and reopen the position with the new data. And it all has to be checked each time. I hope the description is clear:)))
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Is it possible to pass an array to a function that doesn't start with a zero element? For example, as a reference to the i-th element, and how would this look?
you can
winapi memcpy, etc. to help.
is it possible to pass an array to a function that doesn't start with a zero element? For example, as a reference to the i-th element, and how would that look?
You do not declare an array in the function import, but a simple reference.
When calling the function, pass in the i-th element of the array as a parameter. If you want an array from the beginning, pass in the 0th element of the array as a parameter.
Approximately like this:
This is about right:
Well, it doesn't work in 4 because the index element is not a lvalue when passed to the function.
It works in 5.
Well, this will not work in 4 because the index element is not a lvalue when passed to the function
I didn't realise we were talking about a four.
So these examples are for an external library? And without DLL ?
winapi memcpy does not belong to mql5 either
So these examples are for an external library? And without DLL ?
winapi memcpy does not belong to mql5 either
So these examples are for an external library? And without DLL ?
winapi memcpy does not belong to mql5 either
Good morning!
A word of advice to a very novice))). The question is as follows:
Let's assume a position was opened by a price jump and an ascending MA (it was set in the code), but almost immediately the chart changed, that is, the MA started going down (as well as the entire chart of course)) ). I have to write a function that will close the position at this point, but I have not reached stop loss or limit and reopen the position with the new data. And it all has to be checked each time. I hope the description is clear:)))