Errors, bugs, questions - page 347

 
So it's either a bug in the terminal or in the server history. But more likely the terminal, as the reports from the server history are more likely to have been recovered.
 

Urain:
Так что это или баг терминала, или серверной истории. Но скорее терминала, тк отчёты на чемпе скорее с серверной истории восстанавливались.

That's funny. I wasn't paying attention. Clearly explained.
 
Yedelkin:
That's funny. I wasn't paying attention. Clearly explained.
That's it, who has fun and who has two weeks of catching the bug :o)
 
Found it, it defaults to sorting by time and needs to sort by transaction number. It's all right then.
 
Urain:
Found it, it defaults to sorting by time and needs to sort by transaction number. Then everything is correct.

So there are no errors? The whole point is to count/sort the trades by ticket number, not by time.

I was only superficially reviewing the reports, not calculating position states.

 
Renat:

So there are no bugs? The whole point is to count/sort transactions by ticket and not by time.

I was only superficially reviewing the reports, not calculating position states.

Exactly, it's just that when you save a report there is no automation of this process and it needs to be carefully monitored. I don't think every user will pay attention to this and as a result there will be bugs when parsing the report.

ZS I added sorting after parsing the report. As a result, it all worked for me, but I predict that more than one programmer will have a hard time with this feature.

 

During optimization, name of optimization parameter is displayed in the upper right corner of the optimization graph.


When observing the optimisation, this inscription is annoying because the new maximum is always hidden behind this inscription.

Renat, let's move it to the LEFT top corner! Or the bottom right. Or lower left... Anywhere, just take it out of the upper right corner, for God's sake. Please! :)

// Or at least make it pale and put it in the background so it doesn't obscure the information.

 
MetaDriver:

During optimization, name of optimization parameter is displayed in the upper right corner of the optimization graph.

When observing the optimisation, this inscription is annoying because the new maximum is always hidden behind this inscription.

Renat, let's move it to the LEFT top corner! Or to the bottom right. Or lower left... Anywhere, just take it out of the upper right corner, for God's sake. Please! :)

// Or at least make it pale and put it in the background so it doesn't obscure the information.

Bottom left, and as a background.
 

Please tell me where I went wrong. I am trying to write a simple script that deletes position and pending orders on the current instrument. Here:

//+------------------------------------------------------------------+
//|                                                        clean.mq5 |
//|                        Copyright 2011, MetaQuotes Software Corp. |
//|                                              http://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2011, MetaQuotes Software Corp."
#property link      "http://www.mql5.com"
#property version   "1.00"
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   MqlTick current_tick;
   MqlTradeRequest close_request;
   MqlTradeResult  close_result;
   SymbolInfoTick(_Symbol,current_tick);
   int counter01;
   while(check_position()==true);
     {
      PositionSelect(_Symbol);
      close_request.action=TRADE_ACTION_DEAL; close_request.symbol=_Symbol; close_request.volume=PositionGetDouble(POSITION_VOLUME); close_request.type_filling=ORDER_FILLING_AON;
      if(PositionGetInteger(POSITION_TYPE)==POSITION_TYPE_BUY)
        {
         close_request.price=current_tick.bid; close_request.type=ORDER_TYPE_SELL;
        }
      else
        {
         close_request.price=current_tick.ask; close_request.type=ORDER_TYPE_BUY;
        }
      OrderSend(close_request,close_result);
     }
   do
     {
      for(counter01=1; counter01<=OrdersTotal(); counter01++)
        {
         close_request.order=OrderGetTicket(counter01-1);
         if(OrderGetString(ORDER_SYMBOL)==_Symbol)
           {
            close_request.action=TRADE_ACTION_REMOVE;
            OrderSend(close_request,close_result);
           }
        }
     }
   while(check_order()==true);
   if(GetLastError()!=0)
      Print("ошибка код ",GetLastError()," функция ",__FUNCTION__," строка ",__LINE__);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool check_position() // функция проверяет наличие позиции
  {
   int counter01;
   bool position_exsist=false;
   for(counter01=0; counter01<PositionsTotal(); counter01++)
     {
      if(PositionGetSymbol(counter01)==_Symbol)
        {
         position_exsist=true;
         break;
        }
     }
   return(position_exsist);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
bool check_order() // функция проверяет наличие ордеров
  {
   int counter01;
   bool order_exsist=false;
   for(counter01=0; counter01<OrdersTotal(); counter01++)
     {
      OrderGetTicket(counter01);
      if(OrderGetString(ORDER_SYMBOL)==_Symbol)
        {
         order_exsist=true;
         break;
        }
     }
   return(order_exsist);
  }
//+------------------------------------------------------------------+
The script hangs when there is a position. When debugging it, I found out that it freezes when checking for position. When loop condition while(check_position()==true) starts to be checked, control is passed to check_position() and the first time the function is executed normally, it returns true. But then the loop's body is not executed; it starts checking the condition again and control gets to check_position() and after return(order_exsist) operator does not return to the loop's condition; it goes to the beginning of check_position() function. Please tell me where I made a mistake.
Документация по MQL5: Основы языка / Операторы / Оператор возврата return
Документация по MQL5: Основы языка / Операторы / Оператор возврата return
  • www.mql5.com
Основы языка / Операторы / Оператор возврата return - Документация по MQL5
 
molotkovsm:

Please tell me where I went wrong. I am trying to write a simple script that deletes position and pending orders on the current instrument. Here it is:

The script hangs when there is a position. When debugging it, I found out that it freezes when checking for the position. When loop condition while(check_position()==true) starts checking, control is passed to check_position() function and at first time function is executed normally, returns true. But then the loop's body is not executed; it starts checking the condition again and control gets to check_position() and after return(order_exsist) operator does not return to the loop's condition; it goes to the beginning of check_position() function. Please tell me where I must be mistaken.

If there is a position, you will get an infinite loop because

while(check_order()==true);

Equals

while(check_order()==true)
{
 //  пустой оператор
}
There is no way to break out of the loop in the code because there is no break in the operator's body;
Reason: