Invalid Expiration - Brazil market, stop orders only...

 

Hi 

I'm getting the "Invalid Expiration" message - not on my machine but on a users machine.... I did a search but couldn't find anything for this specific case.

We first saw the issue last week when he was submitting Time In Force to GTC on limit & stop orders. He's in Brazil and it rejected every order.  When he used "DAY", the limit orders worked fine but the stop orders still don't work. 

At no point have we set the actual "expiration" dateTime property, we are just using the type_time property.

There's 2 issue I'm trying to fathom here.

1 - What exactly to set so it works for the Brazil markets

2 - How to know to use different settings in that specific case

3 - Whether there is any documentation anywhere on what should be sent (I realize this is probably a function of the exchanges)

The code we use to create the order is below - works fine on US Futures and Eurex Futures markets.

Thanks

Pete


         request.symbol = a1[4];
         request.volume = (int)a1[16];
         request.sl = 0;
         request.tp =0;
         request.type = (int)a1[9];
         request.type_time = (int)a1[6]; 
         request.comment=a1[19];         
         if( a1[9] == ORDER_TYPE_BUY)
         {
            request.price = last_tick.ask; 
         }
         else if( a1[9] == ORDER_TYPE_SELL)
         {
            request.price = last_tick.bid; 
         }
         else if( a1[9] == ORDER_TYPE_BUY_STOP || a1[9] == ORDER_TYPE_SELL_STOP)
         {
            request.price = GetMT5Double(a1[12]);
         }
         else if( a1[9] == ORDER_TYPE_BUY_LIMIT || a1[9] == ORDER_TYPE_SELL_LIMIT)
         {            
            request.price = GetMT5Double(a1[11]);
         }
         else if( a1[9] == ORDER_TYPE_BUY_STOP_LIMIT || a1[9] == ORDER_TYPE_SELL_STOP_LIMIT)
         { 
            request.stoplimit = GetMT5Double(a1[11]);
            request.price = GetMT5Double(a1[12]);
         }         
         OrderSend(request, result);
 

take a look

https://www.mql5.com/pt/forum/37445

https://www.mql5.com/pt/forum/40174

Como programar Pending Orders para o mini-dólar
Como programar Pending Orders para o mini-dólar
  • 2015.01.28
  • www.mql5.com
Depois mudei o EA e coloquei Pending Orders, mas, para a minha surpresa, nos backtests sempre aparecia a mensagem "Invalid Expiration" para a BUY STOP/SELL STOP order, testando no WDO@.
 
JigsawTrading:

Hi 

I'm getting the "Invalid Expiration" message - not on my machine but on a users machine.... I did a search but couldn't find anything for this specific case.

We first saw the issue last week when he was submitting Time In Force to GTC on limit & stop orders. He's in Brazil and it rejected every order.  When he used "DAY", the limit orders worked fine but the stop orders still don't work. 

At no point have we set the actual "expiration" dateTime property, we are just using the type_time property.

There's 2 issue I'm trying to fathom here.

1 - What exactly to set so it works for the Brazil markets

2 - How to know to use different settings in that specific case

3 - Whether there is any documentation anywhere on what should be sent (I realize this is probably a function of the exchanges)

The code we use to create the order is below - works fine on US Futures and Eurex Futures markets.

Thanks

Pete


Add this line :

      request.type_filling=ORDER_FILLING_RETURN;
Not related, but you should always check the return value and return code of OrderSend().
 
Alain Verleyen:

Add this line :

Not related, but you should always check the return value and return code of OrderSend().


Many thanks! Adding "ORDER_FILLING_RETURN" seems to have fixed it!


Thanks a million....


Peter

Reason: