Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1422
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
I do not know why the Expert Advisor in the Strategy Tester works fine, places orders, etc., but in the real account, although the robot is active, orders are not placed
You need to read the magazine, there may be an answer
Can you tell me how to get this -
get this -
Can you tell me how to get this -
get this -
An explicit type conversion.
You can also round an integer from a non-integer, but the double will be 18.0
Then I will repeat the question.
The expression
if (izmb>b ||izmb<b || izms>s || izms<s)
is identical to this one:
if (izmb!=b || izms!=s)
And if you want to store something, do it in a global variable.
This is the one that is declared outside the body of the function.
Good day to you all!
Question about MQL4. Here is a simple code
It creates a two-dimensional array and fills it with values. There are two functions in the code that interest me - ArrayFill(LoY,0,31,0.5555); and ArraySort(LoY,WHOLE_ARRAY,0,MODE_ASCEND); According to the Reference Manual, both functions work with two-dimensional arrays.ArrayFill() works strictly on arrays filled horizontally, the Reference book specifies that it fills the array with values strictly from left to right (not top-down or bottom-up). ArraySort() sorts a two-dimensional array by the first dimension. The Reference does not say whether it sorts horizontally filled or vertically filled arrays. Judging by the execution of my code, ArraySort() sorts only vertically filled arrays. It seems these two functions cannot handle one and the same array in one program.
Q. It is important for me, that ArraySort() function would work correctly . So, can ArraySort() be configured to sort horizontally filled arrays, with which ArrayFill() works? Or the sorting function from MQL5, which works in MQL4, can help me instead? Or is there a function that converts a horizontally filled array with all its values to a vertical one, in a nutshell, how to make my program sort an array horizontally
Note. Using a loop instead of ArrayFill() does not work for me.
Thanks for the help.
Good day to you all!
Question about MQL4. Here is a simple code
It creates a two-dimensional array and fills it with values. There are two functions in the code that interest me - ArrayFill(LoY,0,31,0.5555); and ArraySort(LoY,WHOLE_ARRAY,0,MODE_ASCEND); According to the Reference Manual, both functions work with two-dimensional arrays.ArrayFill() works strictly on arrays filled horizontally, the Reference book specifies that it fills the array with values strictly from left to right (not top-down or bottom-up). ArraySort() sorts a two-dimensional array by the first dimension. The Reference does not say whether it sorts horizontally filled or vertically filled arrays. Judging by the execution of my code, ArraySort() sorts only vertically filled arrays. It seems these two functions cannot handle one and the same array in one program.
Q. It is important for me, that ArraySort() function would work correctly . So, can ArraySort() be configured to sort horizontally filled arrays, with which ArrayFill() works? Or the sorting function from MQL5, which works in MQL4, can help me instead? Or is there a function that converts a horizontally filled array with all its values to a vertical one, in a word, how to make my program sort an array horizontally
Note. Using a loop instead of ArrayFill() does not work for me.
Thank you for your help.
Did you notice the
note
Multidimensional array when processing with ArrayFill() appears as one-dimensional, for example, array[2][4] is processed as array[8], so when working with this array it's acceptable to specify index of initial element equal to 5. So, calling ArrayFill(array, 5, 2, 3.14) for array[2][4] will fill array[1][1] and array[1][2] with 3.14.
This string
will fill the array with exactly one line.
As for verticality/horizontality, this is how you would hold your head looking at the entry. Look at the Excell table and everything will become clear. If column "A" is filled with values, you get a one-dimensional array. How is it arranged? Right... horizontally, because I'm looking at it lying on the sofa.........
Have you noticed the
note
This line
will fill the array with exactly one line.
As for verticality/horizontality, it's how you would hold your head looking at the entry. Look at the Excell table and everything will become clear. If column "A" is filled with values, you get a one-dimensional array. How is it arranged? Right... horizontally, because I'm looking at it lying on the couch.........
Thanks for the reply. Got everything you wrote. But didn't understand the meaning of what you wrote in terms of my problem.
By horizontal two-dimensional array in my code I mean when there are 2 rows under index 0 or 1 and columns under indexes 0 to 30. The first dimension is denoted as[0][0],[0][1],[0][2], ...[0][30] The second dimension is denoted as[1][0],[1][1],[1][2], ...[1][30]
By vertical two-dimensional array in my code I mean when there are 31 rows indexed 0 to 30 and 2 columns indexed 0 and 1. The first dimension is denoted as[0][0],[1[0],[2][0], ...[30][0] The second dimension is denoted as[0][1],[1][1],[2][1], ...[30][1]
If you execute my code, the array will fill vertically. And the ArraySort() function will sort the array as it should.
QUESTION Why won 't ArrayFill() function work in this case ? After all, I asked it to fill the first dimension of the array (31 items) with the same values 0.5555 on the twentieth minute.
Thanks for your help.
I would try that.
Thank you for your help. I'll give it a try.
the expression
is identical to this one:
And if you want to store something, do it in a global variable.
This is the one that is declared outside the body of the function.
We wanted to check the conditions of search for entering the EA not every tick, but only if another order is opened or closed by another EA or manually (in order to avoid unnecessary load on the processor). This is why we need to check if the number of orders corresponds to each tick.
Can we use a static variable ? Will the program work in such a form?