MQL5: Validation :-( I've already racked my brain to find out what it is and how it's solved. - page 2

 
Alexandr Gavrilin:

Other messages on margin shortage are coming.

I tried as described in the error to sum up all lots for the instrument in a given direction, taking into account pending orders and not to give a command to open, if exceeded taking into account the open order, to no avail.

The error is the same, my debug messages are not displayed in the report log during validation I don't know how to catch and debug this error or how to emulate this error in my terminal

Error.

 
Alexandr Gavrilin:

....

The error is the same, my debug messages do not show up in the report logs during validation I don't know how I can catch and debug the handling of this or how to simulate that error in my terminal...

Try to open a position with a very large volume. See if your EA will catch this error or not.

 
Alexandr Gavrilin:

Other messages on margin shortage are coming in.

I tried as described in the error to sum up all lots for the instrument in a given direction taking into account pending orders and not to give a command to open, if exceeded taking into account the open order, it is useless.

The error is the same, I don't know how to trace and debug this error or how to emulate it in my terminal.

You can check Margin Level. Let's say if it's less than 5000% then no trades will be executed.

 
Vladimir Karputov:

Mistake.

Resolved.

//в функции до открытия ордера.

double max_volume=SymbolInfoDouble(m_name,SYMBOL_VOLUME_LIMIT);

      double current_lots=getAllVolume();

      if(max_volume>0 && max_volume-current_lots-dlot<=0)
        {
         //PrintFormat("%.2f - %.2f",max_volume , dlot);
         return 0;
        }
//...
//функция подсчета объема
double getAllVolume()
     {
      int itotal=PositionsTotal();
      ulong uticket=-1;
      double dVolume=0;

      for(int i=itotal-1;i>=0;i--)
        {
         if(!(uticket=PositionGetTicket(i))) continue;

         if(PositionGetString(POSITION_SYMBOL)==m_symbol.Name())
            dVolume+=PositionGetDouble(POSITION_VOLUME);
        }

      itotal=OrdersTotal();

      for(int i=itotal-1;i>=0;i--)
        {
         if(!(uticket=OrderGetTicket(i))) continue;

         if(OrderGetString(ORDER_SYMBOL)==m_symbol.Name())
            dVolume+=OrderGetDouble(ORDER_VOLUME_CURRENT);
        }

      return dVolume;
     }
The product then passed the checks successfully.
 
Alexandr Gavrilin:

Resolved.

The product was then successfully tested.

:)

 

Oh, by the way, note in your calculations thatSYMBOL_VOLUME_LIMIT can be "0.0".

So as not to get caught in the check:

if(check_volume > SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_LIMIT))
   return;
 
Vladimir Karputov:

Oh, by the way, note in your calculations thatSYMBOL_VOLUME_LIMIT can be "0.0".

So as not to get caught in the check:

About this message, something is wrong:failed instant sell 3.30 EURUSD at 1.14380 [Volume limit reached].

I had a netting account and no limit or pending orders. All the checks were present.

Now I checkedSYMBOL_VOLUME_LIMIT, irrespective of whether there is an open order or not, it always returns 0. I always have one position (since I am a netting type) and this message only appears when I increase the lot and only when I auto-loop.

 
Petros Shatakhtsyan:

About this message, something is wrong:failed instant sell 3.30 EURUSD at 1.14380 [Volume limit reached].

I had a netting account and no limit or pending orders. All the checks were present.

Now I checkedSYMBOL_VOLUME_LIMIT, irrespective of whether there is an open order or not, it always returns 0. I always have one position (since I am a netting type) and this message appears only when I increase my lot and only when I am autotrading.

If you work on some server, it doesn't mean that all servers around have the same settings :) .

 
Vladimir Karputov:

If you work on a certain server, it doesn't mean that all servers around have the same settings :) .

And so I check on different servers, about 5-6, where there are different execution types. Here on this post the execution type is Instant.

But that's not the main thing. Autovalidation gives little information, and it makes it difficult to find an error. And there is always a way around it.

 
Yesterday I went through Autovalidation on update. On MT5 with half a poke, but MT4 spent almost the whole evening with all orders not taken. I had enough of it, I went back to the platform after a couple of hours. I got bored and came back after a couple of hours. Sometimes the problem is not with the Expert Advisor but with the service.