To set EA's lotsize as 0.01 is not validated. Why?

 

Hello,
I am trying to input my EA into the mql5 market. My lotsize parameter is fixed as 0.01 lot size.
However, it could not be validated for the market. When I try a higher fixed lotsize as 2.00 lotsize,
it could be validated. 

I want to publish my EA with a fixed lotsize as 0.01. How can I do that?
Do you have any suggestions?

Murat Y.

 
Murat Yazici:

Hello,
I am trying to input my EA into the mql5 market. My lotsize parameter is fixed as 0.01 lot size.
However, it could not be validated for the market. When I try a higher fixed lotsize as 2.00 lotsize,
it could be validated. 

I want to publish my EA with a fixed lotsize as 0.01. How can I do that?
Do you have any suggestions?

Murat Y.

It validate ALL trading symbol/market.
you should use MODE_MINLOT

 
Mohamad Zulhairi Baba #:

It validate ALL trading symbol/market.
you should use MODE_MINLOT

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);
}

I used this code to check volume.
When I use a fixed lot size as 0.01 => not validated.
When I use a fixed lot size as 2.00 => validated.

I want to set the fixed 0.01 lotsize  in my EA on the market.

 
Maybe about the symbol settings
 
Murat Yazici # :

I used this code to check volume.
When I use a fixed lot size as 0.01 => not validated.
When I use a fixed lot size as 2.00 => validated.

I want to set the fixed 0.01 lotsize  in my EA on the market.

0.01 != minimum lot

Some symbols have a minimum lot of 1.0 or 0.2...

 

Use the article ' An attempt at developing an EA constructor '.

The EA code is posted in CodeBase ( Trading engine 4 ). Three types of lot can be set:

Position size management (lot calculation)

The lot can be either permanent (' Money management ' set to ' Constant lot ' and set the lot size to ' The value for "Money management" ') and dynamic - in percent risk per trade (' Money management ' set to ' Risk in percent for a deal ' and set the risk percentage in ' The value for "Money management" '). You can also set a constant lot equal to the minimum lot - ' Money management ' set to ' Lots Min '.

Lot check ( Constant lot ):

//--- check the input parameter "Lots"
   string err_text="";
   if(InpLotOrRisk==lot)
     {
      if(!CheckVolumeValue(InpVolumeLotOrRisk,err_text))
        {
         if(MQLInfoInteger(MQL_TESTER)) // when testing, we will only output to the log about incorrect input parameters
            Print(__FILE__," ",__FUNCTION__,", ERROR: ",err_text);
         else // if the Expert Advisor is run on the chart, tell the user about the error
            Alert(__FILE__," ",__FUNCTION__,", ERROR: ",err_text);
         //---
         m_init_error=true;
         return(INIT_SUCCEEDED);
        }
     }
   else
      if(InpLotOrRisk==risk)
        {
         if(m_money!=NULL)
            delete m_money;
         m_money=new CMoneyFixedMargin;
         if(m_money!=NULL)
           {
            if(InpVolumeLotOrRisk<1 || InpVolumeLotOrRisk>100)
              {
               Print(__FILE__," ",__FUNCTION__,", ERROR: ");
               Print("The value for \"Money management\" (",DoubleToString(InpVolumeLotOrRisk,2),") -> invalid parameters");
               Print("   parameter must be in the range: from 1.00 to 100.00");
               //---
               m_init_error=true;
               return(INIT_SUCCEEDED);
              }
            if(!m_money.Init(GetPointer(m_symbol),InpWorkingPeriod,m_symbol.Point()*digits_adjust))
              {
               Print(__FILE__," ",__FUNCTION__,", ERROR: CMoneyFixedMargin.Init");
               //---
               m_init_error=true;
               return(INIT_SUCCEEDED);
              }
            m_money.Percent(InpVolumeLotOrRisk);
           }
         else
           {
            Print(__FILE__," ",__FUNCTION__,", ERROR: Object CMoneyFixedMargin is NULL");
            return(INIT_FAILED);
           }
        }
//--- create handle of the indicator iCustom
An attempt at developing an EA constructor
An attempt at developing an EA constructor
  • www.mql5.com
In this article, I offer my set of trading functions in the form of a ready-made EA. This method allows getting multiple trading strategies by simply adding indicators and changing inputs.
 
Brokers have different market symbol minimum lot to trade.
 

Thank you for all! I don't know the solution however Viladimir Karputov's solution, article was helpful for me.
It seems that there should be something in the EA for the "test mode" for the validation aan EA for the MQL5 Market.

I decided to set my EA with different parameters. Everything is okay. It is validated for the MQL5 Market.
However, to get the information as below was very important for me.

It seems that there should be something in the EA for the "test mode" for the validation aan EA for the MQL5 Market.

Thank you again for all!

Reason: