Errors, bugs, questions - page 3155

 
murziks #:


Can you tell me what else Metatrader can read instead of csv?

Binary files can read and write. Variables, structures, arrays. All this is written to files and read back.

 

Dear mobile terminal developers, please fix the handling of emails in the "Mail" tab already.

Before the latest build of the mobile terminal (Android), when connecting to an account, the "Mail" tab is full of e-mails that have been deleted many times before.

As soon as I reconnect to the account, I see a mess of previously deleted and undeleted e-mails in the Mail tab. What do I have to do to get rid of it?

 

Please explain what changes in the terminal for the PC "Tools > Settings > Show Trading History", if at any value of the checkbox you can enable/disable the display of the trading history through "PCM > Trade History" and "F8 > Show Trading History"?

That is, I can disable the display of the trading history in the general settings of the terminal, so it will not interfere with it, while it will be shown on any chart if it is enabled in the chart settings or using the PCM. I do not understand the logic.

 

Dear developers of the PC terminal. For a long time now, when working with chart profiles (not templates, but just profiles) there has been a strange logic that any change in a profile automatically causes it to be saved without a manual indication of it.

Errors in profile customization by the user or terminal failure turn a hard-to-configure workspace into a pumpkin.

Why can't we make it so that until the user manually saves the profile, the changes made to the profile would not be saved (let them be saved to a temporary profile file and not to the last working profile) ?

We have been waiting for many years for changes in the built-in interface a la TradingView, it is probably not difficult for you, and it is very convenient for users.

 

Why is there such a difference for example a test with the "profit in pips to speed up calculations" checkbox a 15% drawdown, and without this checkbox a 93% drawdown?

Which result is more correct?

Number of trades is the same

In this case, a profit of 2 quid in the first case and 20 quid in the second case with the same lot.

Just as it is visible if you change the lot is also a difference of 10 bucks.

 
Thank you. You wouldn't want to txt
 
Cryptocurrencies have disappeared from MQ's servers. Degradation, sadness and frustration.
 

Errors in Generic/Queueue.

Forum on trading, automated trading systems and strategy testing

[POSSIBLE ERROR] Class of CQueue container

Loris De Marchi, 2022.02.14 13:00

Hi all!!!

I suspect that at least in CQueueue::Contains(T item) and CQueueue::Remove(T item) methods there is an error.

The queue is managed using the classic head-tail circular system, so this code must be wrong:

 //+------------------------------------------------------------------+
//| Removes all values from the CQueue<T>.                           |
//+------------------------------------------------------------------+
template < typename T>
bool CQueue::Contains(T item)
  {
   int count=m_size;
//--- try to find item in array
   while (count--> 0 )
     {
       //--- use default equality function
       if (::Equals(m_array[count],item))
         return ( true );
     }
   return ( false );
  }

Also the incorrect description of the method above makes me think that some mistakes may have been made when writing this class.


The Remove method clearly fails when running this simple code, for example:

   CQueue< ulong > foo;
   foo.Enqueue( 1 );
   foo.Remove( 1 );
   foo.Enqueue( 2 );
   printf (foo.Contains( 2 ));

It prints "false" when the item is clearly in the queue...


Let me know if this class is fixed or if I should use one of mine.

Thanks!


 

Hello. We know that arrays in MQL can be both forward and reverse indexed (series). That's why I have a question, what's the best way to work with arrays in MQL, if a series or reverse indexation is needed? The first variant of getting the value by index for the series may look as follows.

double arrayValue(const double array[], conct int shift) {
  int len = (int)array.Size();
  if (shift < 0 || shift >= len)
    return WRONG_VALUE;
  return array[len - shift - 1];
}

The second way is to useArraySetAsSeries.

double arrayValue(double &array[], conct int shift) {
  int len = (int)array.Size();
  double ret;
  if (shift < 0 || shift >= len)
    return WRONG_VALUE;
  if (!ArraySetAsSeries(array, true))
    return WRONG_VALUE;
  ret = array[shift];
  ArraySetAsSeries(array, false);
  return ret;
}

Of course, I'm not asserting anything, but I think because ArraySetAsSeries simply turn on the array flag series and when accessing a value by index occurs as in the first example.

double arrayValue(const double array[], conct int shift) {
  int len = (int)array.Size();
  if (shift < 0 || shift >= len)
    return WRONG_VALUE;
  return array[len - shift - 1];
}

And this is roughly how it handles addressing the value by the index.

Does it make sense to include the series for arrays in the OnCalculate indicator handler each time, or it would be better to address the low bar using the length of arrays rates_total?

int OnCalculate(const int rates_total,
                const int prev_calculated,
                const int begin,
                const double &price[]) 
{
  Print(price[rates_total-1]); // получение цены на младшем баре без использования серии
  return(rates_total);
}

Are these two methods equal in speed or am I mistaken in my reasoning?

 

The terminal does not return the accumulated profit of closed positions. Can you tell me where the problem might be?

double GetClosedPositionsInstrumentProfit(string symbol, datetime from) 
{
   HistorySelect(from, TimeCurrent());

   double profitSum = 0;

      for (int i = HistoryDealsTotal()-1; i >= 0; i--) 
    {   
      ulong ticket = HistoryDealGetTicket(i);
      if (ticket < 0) continue; 
      long magic = HistoryDealGetInteger(ticket, DEAL_MAGIC);
      if (magic != EXPERT_MAGIC) continue; 
      string positionSymbol = HistoryDealGetString(ticket, DEAL_SYMBOL);
      if (symbol != positionSymbol) continue; 
      
      double profit = HistoryDealGetDouble(ticket, DEAL_PROFIT) + HistoryDealGetDouble(ticket, DEAL_SWAP)+ HistoryDealGetDouble(ticket, DEAL_COMMISSION);
      profitSum += profit; 
         
      Print ("Profit " + DoubleToString(profitSum,2));              
    }         
   return profitSum;
}
Reason: