Jump to content
  • 0

OrderSend error 131


FXBarom

Question

My MT4 trading system that works normally with other MT4 brokers always fails in IG Forex Metatrader 4 tester with "invalid trade volume" error.

OrderSend SELL error: invalid trade volume, P=1.1282, Bid=1.1282, SL=1.1302, TP=0.0000, Lot=0.1

I have tried to set a lot size to 0.1, 1, 10 - no difference, the same error occurs.

Also, I've found that IG MT4 server does not return valid values for the lots info:

The following MQL4 code:

 Print("MODE_MINLOT= ", MarketInfo(Symbol(), MODE_MINLOT));
 Print("MODE_LOTSTEP= ", MarketInfo(Symbol(), MODE_LOTSTEP));
 Print("MODE_MAXLOT= ", MarketInfo(Symbol(), MODE_MAXLOT));

returns zeroes for all three values

 

aezonemt4.png

Link to comment

3 answers to this question

Recommended Posts

  • 0
12 hours ago, FXBarom said:

My MT4 trading system that works normally with other MT4 brokers always fails in IG Forex Metatrader 4 tester with "invalid trade volume" error.

OrderSend SELL error: invalid trade volume, P=1.1282, Bid=1.1282, SL=1.1302, TP=0.0000, Lot=0.1

I have tried to set a lot size to 0.1, 1, 10 - no difference, the same error occurs.

Also, I've found that IG MT4 server does not return valid values for the lots info:

The following MQL4 code:

 Print("MODE_MINLOT= ", MarketInfo(Symbol(), MODE_MINLOT));
 Print("MODE_LOTSTEP= ", MarketInfo(Symbol(), MODE_LOTSTEP));
 Print("MODE_MAXLOT= ", MarketInfo(Symbol(), MODE_MAXLOT));

returns zeroes for all three values

 

aezonemt4.png

Hi @FXBarom,

Please reach out to helpesk.us@ig.com with your account details and information above. Our team will be able to investigate and come back to you with a solution.

All the best - Arvin

Link to comment
  • 0

Thank you, I will, but don't know why account details are relevant if it fails in MT4 Strategy Tester that has absolutely independent settings, in particular allows to set a spread, balance, etc. that have nothing to do with real market and account type.

I'm aware about 2-step order brokers and tried both approaches.

=============

   if (type== OP_SELL ) {
       P= Bid;

      //TP= OP- PipToPrc(OC);

       if (TakeProfit> 0) {
           TP = P- PipToPrc(TakeProfit);
       } else
           TP= 0;


       P= NormFXPrice(P); TP= NormFXPrice(TP); SL= NormFXPrice(SL);

       if (TwoStepOrder) {
           T= OrderSend( Symbol(), OP_SELL, LotSize, P, 3, 0, 0);//, OrdComm, MagicNumber, 0, SellColor);

           Sleep(DELAY);

         if (T< 1) {
            PrintOrderError(T, "2-step OrderSend error ", GetLastError(), P, Bid, 0, 0);
         } else {
            if ( !OrderModify(T, OrderOpenPrice(), SL, TP, SellColor) )
               PrintOrderError(T, "OrderModify error ", GetLastError(), P, Bid, SL, TP);
        }

       } else {
          T= OrderSend( Symbol(), OP_SELL, LotSize, P, 3, SL, TP);
          if (T< 1)
           Print("OrderSend SELL error: "+ ErrorDescription(GetLastError())+ ", P="+ PrcToStr(P)+ ", Bid="+ PrcToStr(Bid)+ ", SL="+ PrcToStr(SL)+ ", "+"TP="+ PrcToStr(TP)+ ", Lot="+ LotSize);
      }
   }

 

Edited by FXBarom
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...