Discussion of article "Orders, Positions, and Deals in MetaTrader 5" - page 3

 

Renat:

Yedelkin:

Quote from the article: "When connection to the trade server is lost, the terminal periodically makes attempts to restore connection".

What is the frequency of attempts to restore connection?

Every 5 seconds

Another question on the same topic. How does the TerminalInfoInteger(TERMINAL_CONNECTED) function work : does it make an immediate attempt to reach the server when it is called, or does it take data about the presence/absence of connection from the mql5-program environment, which is updated once every 5 seconds?

In other words, can we count on the fact that the call of the TerminalInfoInteger(TERMINAL_CONNECTED) function will return actual information about the current real state of the connection, regardless of the fact that the terminal itself in such a situation checks the connection only once every 5 seconds?

Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Состояние клиентского терминала
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Состояние клиентского терминала
  • www.mql5.com
Стандартные константы, перечисления и структуры / Состояние окружения / Состояние клиентского терминала - Документация по MQL5
 
The function returns the current connection state without any attempts to raise the connection. Reconnects work automatically and independently.
 
Renat:
The function returns the current connection state without any attempts to raise the connection. Reconnects work automatically and independently.

I understand that when the connection is lost, theTerminalInfoInteger(TERMINAL_CONNECTED) function will return the data that was generated after the last 5-second reconnect. Thanks!

 
No. The function will show the current status of the connection. It has nothing to do with 5 sec.
 
Renat:
No. The function will show the current status of the connection. It has nothing to do with 5 seconds.

Oh, I'm having a hard time grasping science today...

It turns out that in case of connection loss the TerminalInfoInteger(TERMINAL_CONNECTED) function will show the current real state of connection but will not try to restore connection. OK, for my purposes this is very handy. Thanks!

 

Very Helpful 

Thank you  

 

How to select history orders/ deals/ position by incremental indexing.

Such as:

    for(uint i = uint(HistoryDealsTotal()-1); i >= 0; i--)
    {
    if(deal.SelectByIndex(i) == true)
    {
    //--my data
    }
    }

Is it possible? 

 

Thanks for your interesting article 

 

Forum on trading, automated trading systems and testing trading strategies

Discussion of article "Orders, Positions, and Deals in MetaTrader 5"

Tanvir Ahmed, 2017.10.21 16:52

    for(uint i = uint(HistoryDealsTotal()-1); i >= 0; i--)
    {
    if(deal.SelectByIndex(i) == true)
    {
    //--my data
    }
    }

Infinite loop!

 
MetaQuotes Software Corp.:

New article Orders, Positions, and Deals in MetaTrader 5 is published:

Author: MetaQuotes


very helpful!!!!!!!thanks!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1