Upload EA on Market

 

  Dear sirs,

I cannot upload the robot on market because tester fails. It always returns me this volume limit reached in screenshot: 

 I wrote boolean function to check volume then opens 1 trade and after fails volume limit reached. what volume limit ? Anybody knows ?

Files:
 
Marius Ovidiu Sunzuiana:

  Dear sirs,

I cannot upload the robot on market because tester fails. It always returns me this

You need to fix your code.

 
your EA must be able to check the correct volume of the orders based on the currency pairs and broker conditions before sending an order.
 
Hossein Zandi:
your EA must be able to check the correct volume of the orders based on the currency pairs and broker conditions before sending an order.

guys please look at update screenshot. It open 1 order then fails because volume limit reached.

 
Marius Ovidiu Sunzuiana:

guys please look at update screenshot. It open 1 order then fails because volume limit reached.

what function shall I write to check broke conditions of trading operations

 
@Eleni Anna Branou I don t know what to fix because I don t understand the return message... in strategy tester works but if test for market upload does not work
 

The checks a trading robot must pass before publication in the Market 

Before making a trade request for placing a pending order by a symbol, you should check the limitation on the total volume of open position and pending orders on one symbol - SYMBOL_VOLUME_LIMIT. If there is no limitation, then the volume of a pending order cannot exceed the maximum allowed volume that can be received using the SymbolInfoDouble() volume.

double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_LIMIT);
if(max_volume==0) volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
----------------

https://www.mql5.com/ru/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_integer 

SYMBOL_VOLUME_LIMIT

Maximum allowed aggregate volume of an open position and pending orders in one direction (buy or sell) for the symbol. For example, with the limitation of 5 lots, you can have an open buy position with the volume of 5 lots and place a pending order Sell Limit with the volume of 5 lots. But in this case you cannot place a Buy Limit pending order (since the total volume in one direction will exceed the limitation) or place Sell Limit with the volume more than 5 lots.

double

The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks, as a small error in the expert or indicator logic can cause losses on the trading account. That is why we have developed a series of basic checks to ensure the required quality level of the Market products. If any errors are identified by the Market...
 

and I found the thread in Russian forum:

MQL5: Validation :-( I have already broken my mind over the search for what it is and how it is solved. 

I am not a coder but there are two post from this thread (hope it helps):

Forum on trading, automated trading systems and testing trading strategies

MQL5: Validation :-( I have already broken my mind over the search for what it is and how it is solved.

Alexandr Gavrilin , 2018/11/27 08:04

I decided.

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

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;
     }
After that, the product successfully passed the test.

Forum on trading, automated trading systems and testing trading strategies

MQL5: Validation :-( I have already broken my mind over the search for what it is and how it is solved.

Vladimir Karputov , 2018/11/27 11:36

Yes, by the way, consider when calculating that SYMBOL_VOLUME_LIMIT can be equal to "0.0".

In order not to fall for verification:

 if (check_volume > SymbolInfoDouble (Symbol(), SYMBOL_VOLUME_LIMIT ))
   return ;

 
OK I will review thanks guys
 

hello Marius Ovidiu Sunzuiana  


did find out how to solve this error ?

Reason: