Issue with wrong lot size

 

Hi,

Writing a pretty simple EA and everything seemed to work. Now running it on a different broker it keeps giving the 131 error. I tried getting the min lots, max lots, lot step with Marketinfo, it returns that minlot is 0.01, but for bot maxlot and lotstep it returns 0. What does that mean? 

Mihkel

 

https://www.mql5.com/en/forum/192920

Error code Ordersend error 131
Error code Ordersend error 131
  • 2017.05.19
  • www.mql5.com
Dear Friends I just build an EA for autotrade. But I cant upload it to Market due to this Error 131 occur. Please help me to resolve this...
 
EnriqueD:

https://www.mql5.com/en/forum/192920


This offers no help though to my case?

Or if you're trying to say for me to search for answers before posting, then I did. I would understand this if I just asked what error 131 is, but I'm more specifically asking how can it be that minlot is 0.01 and lotstep and maxlot both 0 and what it means, which is a different question IMO and one that I can't find an answer to nowhere. 

 
Mihkelt:

This offers no help though to my case?

Or if you're trying to say for me to search for answers before posting, then I did. I would understand this if I just asked what error 131 is, but I'm more specifically asking how can it be that minlot is 0.01 and lotstep and maxlot both 0 and what it means, which is a different question IMO and one that I can't find an answer to nowhere. 

If you don't get the correct values, either there is a bug in your code or it may happen the broker don't provide them.

Show your code and/or ask to your broker.

And it's always a good idea to search for answers before posting :-)

 
double CorrectLot( const double Lot )
{
  static const double StepVol = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_STEP);
  static const double MaxVol = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MAX);
  static const double MinVol = SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_MIN);

  const double Vol = StepVol * (int)(Lot / StepVol + 0.5);

  return((Vol < MinVol) ? MinVol : ((Vol > MaxVol) ? MaxVol : Vol));
}
Reason: