Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 660

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
this code works, do it by analogy:
Made minimal changes - removed OrderMagicNumber() analysis and added three logs.
The result, unfortunately, is the same - see pr. - On the first screenshot it starts (I don't know why it doesn't start with 0), and on the second one it starts with 124 to 99.
int NumberOfOrders()
{
int i,res=0,k=OrdersTotal(); string sy=Symbol();
for(i=0; i<k; i++)
{
log("k = " + k +"; ");
log("i = " + i +"; ");
if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
{
if((OrderSymbol()==sy)) res++; //if((OrderMagicNumber()==magic_) && (OrderSymbol()==sy)) res++;
log("res = " + res +"; ");
}
}
return(res);
}
Does this code really compile without errors??? I don't believe it...
(it's unclear why it doesn't start with 0), and on the second place where it comes from 124 to 99.
because the terminal "ate" a part of Print(), output in MQL has the lowest priority, add Slepp(123) before Print() and there will be no skips
although according to the log you are just printing the loop counter
because the terminal "ate" part of Print(), in MQL output has the lowest priority, add Slepp(123) before Print() and there will be no skips
although according to the log you are just printing the loop counter
Your reply gives me an impression that I "ate" it simply means that I didn't log it because there were more important things, but my real task was to go through all orders and delete certain ones and I noticed that the EA was skipping some of them (this was not outputting information with the lowest priority). I simplified the task to understand the reason and as a result, we have only the output in the log, but I still see omitted orders, i.e. the Expert Advisor jumps over several orders. The lowest order priority explains very well that the output does not start from 0 but this may explain inconsistent output when it jumps from 124 to 99, for example.
If by "ate" we mean something else, I would like to understand what?
That's awesome!
Roman!
I, for example, am a successful trader with 20 years of experience.
I do not understand why you need "the difference between the closes of the pairs you have entered, anda moving average of them".
Moreover, do you know how to build a moving average of these differences? - Fantastic!
Can you simply draw the moving average of the quotes? - Also no?
So what's the problem?
the difference in close averages does not equal the difference in close averages, alas and ah
What are the doubts? Anyway, no errors in MQL4.
1. Learn how to insert code.
I made minimal changes - removed OrderMagicNumber() analysis and added three logs.
The result, unfortunately, is the same - see above. - On the first screenshot the beginning (I don't know why it doesn't start with 0), and on the second one - the place where it starts with 124 to 99.
2. log is a logarithm???
Note
You can use log()instead of MathLog().
I also found a serious drawback, there are too many CopyClose() calls
Can you tell me how to copy quotes from an array of currency pairs in a loop?
That would appear to be a double array, but MQL doesn't support it, like %.
What do you mean by "double array"?
What do you mean by 'double array'?
Well, two-dimensional.
Well two-dimensional.
Where is it written that CopyClose copies data into a 2D array? Why was the 2D array mentioned in the first place?
Where is it written that CopyClose copies data to a 2D array? Why was the two-dimensional array mentioned?
Because I need to store arrays of quotes in an array
In order to copy it once in a loop and then to perform calculations using ArrayCopy, but not CloseCopy