Always Fail to Publish a MT4 Expert as No Trading Operations!

 

Hello,

I created a trading expert adviser which trading thousands of trades with any broker and any pair.

However, when I am publishing in the mql5.com market it is giving some errors let us say error 131 (volume problem - lots)

//+------------------------------------------------------------------+
//| Check the correctness of the order volume                        |
//+------------------------------------------------------------------+
bool CheckVolumeValue(double volume)
  {
//--- 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);
  }
//+------------------------------------------------------------------+

Then, by following the link provided by mql5.com I added the checks code before the buy/sell operation(s) then the problem became that no trading operations! while it is trading on real time and back test also!

What I can do?

 

Hey Mohammad, 

How are you doing?

What is the volume you are passing? Is it fixed or calculated? 

Did you submit this EA as Netting and Hedging? I noticed errors when submitting as Netting and variable volume (for example 1% of balance) but needed more time to explore the error.

As a workaround, using a fixed lot size solved my problem.

 
Haidar, Lionel Haj Ali #:

Hey Mohammad, 

How are you doing?

What is the volume you are passing? Is it fixed or calculated? 

Did you submit this EA as Netting and Hedging? I noticed errors when submitting as Netting and variable volume (for example 1% of balance) but needed more time to explore the error.

Marhaba Haidar,

Fixed (0.10)

---

will try your final comment for netting or hedging by changing them 

I selected *Scalping* which one you suggest?

 
G
Mohammed Abdulwadud Soubra #:

Marhaba Haidar,

Fixed (0.10)

---

will try your final comment for netting or hedging by changing them 

which you suggest?

Hedging

 
Haidar, Lionel Haj Ali #:
G

Hedging

but no hedging 

my strategy is a simple strategy 

 
Haidar, Lionel Haj Ali #:
G

Hedging

selected the hedging option alone but not yet passed the validation !