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

 
Afternoon!!!

Noticed that I'm having trouble going through orders from j=0 to j=OrdersTotal() - the count keeps going off (see pr).
And it may not start at 0 and jump through a few tens.
Most likely it resumes with every new tick, but it's not clear why it doesn't start with 0, but just jumps through several numbers and how to deal with it.

Has anyone encountered this problem? What is the solution to this situation?
Files:
test.jpg  82 kb
 
Algotrader18:
Afternoon!!!

I've noticed that I'm not able to go through orders from j=0 to j=OrdersTotal() - the count keeps going astray (see previous one).
And it may not start at 0 and jump through a few tens.
Most likely it resumes with every new tick, but it's not clear why it doesn't start with 0, but just jumps through several numbers and how to deal with it.

Has anyone encountered this problem? What is the solution to this situation?

Orders should be enumerated in a loop, not on every tick... To be more precise, a tick has come and all of your orders have been counted in the loop: for(j=0;j<OrderTotal;j++)

OrdersTotal() shows how many orders are open (including pending orders, including orders on all symbols... in total... Here is how many orders are opened in the terminal - this is how many )))).

The order numbering is like in arrays, from 0 to OrdersTotal()-1 - this is the last order, and you probably have a non-existent ticket number [OrdersTotal()] or some other information that is difficult to guess.

 

Good afternoon!


Can you tell me how many characters a comment on an order can hold?

 
Algotrader18:
Afternoon!!!

Noticed that I'm having trouble going through orders from j=0 to j=OrdersTotal() - the count keeps going off (see pr).
And it may not start at 0 and jump through a few tens.
Most likely it resumes with every new tick, but it's not clear why it doesn't start with 0, but just jumps through several numbers and how to deal with it.

Has anyone encountered this problem? What is the way out of this situation?
And why do we even need information on all orders every tick? Wouldn't it be better to introduce restrictions on viewing orders, e.g. every new minute, five minutes, ..., hour?
 

On some VPSs, the font of the EA interface is much larger than programmed in the MKL code.

How to change it, who knows?


 

Question: OnTimer() resets calculations when a tick comes in?

In my OnTick() function I have very big calculations and no data is produced, only after some time, sometimes almost immediately, sometimes a couple of minutes is needed. As far as I know, this is due to the fact that if during the calculation a tick has come, all calculations are stopped and begin again.

But I don't need to make them often, so I would like to put them in a timer?

 
Roman Sharanov:

Question: OnTimer() resets calculations when a tick comes in?

In my OnTick() function I have very big calculations and no data is produced, only after some time, sometimes almost immediately, sometimes a couple of minutes is needed. As far as I know, this is due to the fact that if during the calculation a tick has come, all calculations are stopped and begin again.

But I don't need to make them often, so I would like to put them in a timer?

How do you know this? It doesn't.

Until all calculations that started with the arrival of the tick are completed, all subsequent ticks are skipped.

 
Artyom Trishkin:

How do you know that? It doesn't.

Until all the calculations that started with the arrival of the tick are completed, all subsequent ticks are skipped.

Hmm, I saw somewhere that it's the other way around, so I'm wrong.
I wonder, why with the same calculations when I place an EA on a chart, the results are sometimes immediate and sometimes I have to wait for them for a long time?

That's where the tics come in.

 
Roman Sharanov:

Hm, I've seen somewhere that it is vice versa, it means I am wrong
I wonder, why with the same calculations, when I put the EA on the chart, the results sometimes come right away, and sometimes I have to wait for them for a long time?

And the tics come on.

No one can say without the code.

 
Artyom Trishkin:

No one can tell you without the code.

I also found a serious drawback, too many calls to CopyClose()

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 %.

...
double all_data[N][];
for(int i = 0; i < N; n++){
        CopyClose(Pairs[i], PERIOD_CURRENT, 1, Count, all_data[i]);
}
Reason: