Errors, bugs, questions - page 980

 
Renat:

Absolutely.

And it's too bad you don't understand such simple things.

Could you explain the difference to me? Sincere question, no trolling.
 
voix_kas:
Could you explain the difference to me? Sincere question, no trolling.

Try it yourself, it is the best way to learn.

Although, if you supplement the first question with the condition that the flag is initially true and the intended use of the code is "to trigger only once and skip the assignment a million times", the advice would be different. But the original question did not contain such clarifications.

 

On some instruments the way of calculating the collateral value for the instrument is not defined. MQ server. For example can be seen on instruments under GBOT. Why?

This code can be tested:

//+------------------------------------------------------------------+
//| СКРИПТ                                                           |
//+------------------------------------------------------------------+
void OnStart()
  {
   Print(GetStringTradeCalcMode(SymbolInfoInteger(_Symbol,SYMBOL_TRADE_CALC_MODE)));
   //---
   if(GetLastError()>0)
     Print("GetLastError(): ",GetLastError());
  }
//+------------------------------------------------------------------+
//| Возвращает строку о способе вычисления                           |
//| величины залоговых средств по инструменту                        |
//+------------------------------------------------------------------+
string GetStringTradeCalcMode(long mode)
  {
   string str="?";
//---
   switch((int)mode)
     {
      case SYMBOL_CALC_MODE_FOREX       :
         str="Forex mode";                 break;
      case SYMBOL_CALC_MODE_FUTURES     :
         str="Futures mode";               break;
      case SYMBOL_CALC_MODE_CFD         :
         str="CFD mode";                   break;
      case SYMBOL_CALC_MODE_CFDINDEX    :
         str="CFD index mode";             break;
      case SYMBOL_CALC_MODE_CFDLEVERAGE :
         str="CFD Leverage mode";          break;
     }
//---
   return(str);
  }
 

Question to MQ. Is sorting guaranteed Transactions/Orders. in the order of their historical origin After executing HistorySelect?

Or does the guarantee of chronological order require:

1. Put all transactions/orders selected by theHistorySelect function in a temporary array, including the order/transaction number and date of registration. Is only the number sufficient?

2. Appropriate sorting of the array.

3. Subsequent processing in historical chronological order.

 

Hello.

Do you know if it's possible to return a reference to a variable in MQL5?

That is, something like this:

class Array{

int data[];

Array(int n){

        ArrayResize(data,n);

        ArrayInitialize(data,0); 

} 

int& operator[](const int index){

        return data[index];

} 

} ;
В данном случае компилятор сообщает, что ссылка не может быть использована.
 
voix_kas:

Question to MQ. Is sorting guaranteed Transactions/Orders. in the order of their historical origin After performing HistorySelect?

Or does the guarantee of chronological order require:

1. Put all transactions/orders selected by theHistorySelect function in a temporary array, including the order/transaction number and date of registration. Is only the number sufficient?

2. Appropriate sorting of the array.

3. Subsequent processing in historical chronological order.

No sorting of transactions/orders is guaranteed.

Do everything according to the points you mentioned

 
stringo:

No sorting of trades/orders is guaranteed.

Do everything according to the points you have specified

Thank you. I would also like to understand one clarifying nuance. Probably, it may seem obvious to some people, but then again, it is not explicitly mentioned in documentation, so I would like to hear the answer from the source (MQ representative).

What (single) variable is more reliable to use for sorting the history of deals in the order of history:DEAL_TIME/DEAL_TIME_MSCor a ticket?

So far, I'm leaning towards sorting by ticket, because I suppose that the ticket number is auto-increment in the database on the server. And there is no possibility to break this sequence, for example,if broker wishes to make changes in history, adding new deal with ticket value, less than last deal on the server (not even on the account). I.e. a new trade may be dated (manually) even last year, but the ticket will be formed with the value of autoincrement from the last trade on the server.

Please advise, whether my assumptions are correct? Is it possible to use the trade's ticket as the most reliable as a reference point to build a true historical timeline of the maintenance/logging of transactions?

 

voix_kas:

Can a transaction ticket be used as a the most reliable reference point to build a true historical timeline of the conduct/registration of transactions?

no.
 
sergeev:
No.

Can you reveal your answer? Reasons, alternatives, your personal experience/opinion.

P.S.

Still, would very much like to hear the developer's (MQ) detailed response.

 
voix_kas:

Can you reveal your answer? Reasons, alternatives, your personal experience/opinion.

don't you understand that if you want a timeline, you need time?

what does a timeline have to do with a ticket, the timing of which can change.

Reason: