I want to publish a new EA but I can't pass the market validation

 

Benim uyarlayabileceğim bot altın miktarı ama 1900 gibi bir fiyattanmı deniyor yukaruda eurosd h1 yazıyor ondan mı oluyor anlamadım bilen biri yardım edebilirmi


Bot, altın M5 ile uyumlu, ancak mevcut altın fiyatı 1900 civarında değil. Yukarıda EuroSD H1 de gösteriliyor. Test altın mı yoksa eurusd mı üzerinde yapılıyor? Bulamıyorum. Bilen biri bana yardımcı olabilir mi? Bu testi nasıl geçebilirim?

 
Yigit Kurtoglu:

https://www.mql5.com/en/articles/2555

Invalid volumes in trade operations

Before sending trade orders, it is also necessary to check the correctness of the volumes specified in the orders. The number of lots that the EA is about to set in the order, must be checked before calling the OrderSend() function. The minimum and maximum allowed trading volumes for the symbols are specified in the Specification, as well as the volume step. In MQL5, these values can be obtained from the ENUM_SYMBOL_INFO_DOUBLE enumeration with the help of the SymbolInfoDouble() function.

SYMBOL_VOLUME_MIN

Minimal volume for a deal

SYMBOL_VOLUME_MAX

Maximal volume for a deal

SYMBOL_VOLUME_STEP

Minimal volume change step for deal execution

Example of function for checking the correctness of the volume

//+------------------------------------------------------------------+
//| Check the correctness of the order volume                        |
//+------------------------------------------------------------------+
bool CheckVolumeValue(double volume,string &description)
  {
//--- minimal allowed volume for trade operations
   double min_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MIN);
   if(volume<min_volume)
     {
      description=StringFormat("Volume is less than the minimal allowed SYMBOL_VOLUME_MIN=%.2f",min_volume);
      return(false);
     }

//--- maximal allowed volume of trade operations
   double max_volume=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_MAX);
   if(volume>max_volume)
     {
      description=StringFormat("Volume is greater than the maximal allowed SYMBOL_VOLUME_MAX=%.2f",max_volume);
      return(false);
     }

//--- get minimal step of volume changing
   double volume_step=SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);

   int ratio=(int)MathRound(volume/volume_step);
   if(MathAbs(ratio*volume_step-volume)>0.0000001)
     {
      description=StringFormat("Volume is not a multiple of the minimal step SYMBOL_VOLUME_STEP=%.2f, the closest correct volume is %.2f",
                               volume_step,ratio*volume_step);
      return(false);
     }
   description="Correct volume value";
   return(true);
  }
The checks a trading robot must pass before publication in the Market
The checks a trading robot must pass before publication in the Market
  • 2016.08.01
  • www.mql5.com
Before any product is published in the Market, it must undergo compulsory preliminary checks in order to ensure a uniform quality standard. This article considers the most frequent errors made by developers in their technical indicators and trading robots. An also shows how to self-test a product before sending it to the Market.
 
Yigit Kurtoglu:


Bot, altın M5 ile uyumlu, ancak mevcut altın fiyatı 1900 civarında değil. Yukarıda EuroSD H1 de gösteriliyor. Test altın mı yoksa eurusd mı üzerinde yapılıyor? Bulamıyorum. Bilen biri bana yardımcı olabilir mi? Bu testi nasıl geçebilirim?

Don't forget to also include SymbolInfoDouble (_Symbol, SYMBOL_VOLUME_LIMIT )

Check below:

double GetLot (double lot)
{
  double lotSize=0;
            
         
         double lotsStep = SymbolInfoDouble(Symbol(),SYMBOL_VOLUME_STEP);
         double minLots =SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MIN);
         double maxLots = SymbolInfoDouble(Symbol(), SYMBOL_VOLUME_MAX);
         
         lotSize = MathMax (minLots, lotSize);
         lotSize = MathMin (maxLots, lotSize);
         
         double limlot = SymbolInfoDouble (_Symbol, SYMBOL_VOLUME_LIMIT );       
       
         if(limlot>0 && lotSize>=limlot)lotSize = ymbolInfoDouble (_Symbol, SYMBOL_VOLUME_LIMIT );
         
         
   return lotSize;
}