Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1506

 
Aleksandr Slavskii #:

Besides, your flag of deleting positions and orders after the first deletion is always true, because nowhere in the code you make it false after deleting positions and orders.

Logically, it should be like this.

Alexander, but the fact that these flags are initialised false at the global level, doesn't it count?

Regards, Vladimir.

 
MrBrooklin #:

Alexander, does the fact that these flags are initialised false at the global level not count?

Regards, Vladimir.

no

 
MrBrooklin #:

Alexander, does the fact that these flags are initialised false at the global level not count?

Regards, Vladimir.

Once false. And then they are always true and will delete pending orders and positions on every tick.

 
Aleksandr Slavskii #:

Once false. And then they are always true and on every tick they will delete pending orders and positions.

Well, yes, that makes sense. Thank you for the clarification.

Regards, Vladimir.

 
I keep getting the error "failed market sell 0.01 EURUSD [Unsupported filling mode]" while running my EA on MT5 Strategy Tester. The result code (retcode) returned is 10030. 
Here is my request structure. Please help.
   MqlTradeRequest request = {} ;
   MqlTradeResult  result = {} ;
   double bid = SymbolInfoDouble(Symbol(),SYMBOL_BID)
   request.action = TRADE_ACTION_DEAL ;
   request.magic = Magic ;
   request.symbol = Symbol() ;
   request.volume = 0.01 ;
   request.price = bid ;
   request.deviation = 5 ;
   request.sl = bid + 100 * _Points ;
   request.tp = bid - 200 * _Points ;
   request.type = ORDER_TYPE_SELL ;
   request.type_filling = SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE);

   order_success = OrderSend(request, result) ;


 
Albert Mathenge Strategy Tester, I constantly get the error "failed market sell 0.01 EURUSD [Unsupported filling mode]". The result code (retcode) returns 10030.
Here is the structure of my query. Please help.

Try changing the string

request.type_filling = SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE);

to the string

request.type_filling = ORDER_FILLING_FOK;

And it's strange that the compiler gives only one error. Although, if _Points and order_success were initialised at the global level, then, pardon me!

Regards, Vladimir.

 
MrBrooklin #:

Try changing the string

to the string

And it's strange that the compiler gives only one error. Although, if _Points and order_success were initialised at the global level, then, pardon me!

Regards, Vladimir.

Yeah, I just replaced the variable names for this forum so you wouldn't judge my weird variable names. lol. 
Thanks for the suggestion but I had ORDER_FILLING_FOK before and I was getting the same error. I read that not all Symbols support all filling modes so I changed it to what I have in the original post to make sure only allowed filling modes are specified in the request.
 
Albert Mathenge #:
Yeah, I just changed the variable names for this forum so you don't judge my weird variable names. lol.
Thanks for the suggestion, but I had ORDER_FILLING_FOK before and was getting the same error. I read that not all symbols support all filling modes, so I changed it to the one in the original post to make sure only allowed filling modes are specified in the query.

SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE) returns all allowed filling modes, but you need to specify one specific one of the allowed ones in the request.

 
Albert Mathenge #:
Yeah, I just changed the variable names for this forum so you don't judge my weird variable names. lol.
Thanks for the suggestion, but I had ORDER_FILLING_FOK before and was getting the same error. I read that not all characters support all fill modes, so I changed it to the one in the original post to make sure only allowed fill modes are specified in the query.

I've been using this code for a long time.

ENUM_ORDER_TYPE_FILLING GetFilling(const uint Type = ORDER_FILLING_RETURN)
  {
   const ENUM_SYMBOL_TRADE_EXECUTION ExeMode = (ENUM_SYMBOL_TRADE_EXECUTION)::SymbolInfoInteger(_Symbol, SYMBOL_TRADE_EXEMODE);
   const int FillingMode = (int)::SymbolInfoInteger(_Symbol, SYMBOL_FILLING_MODE);

   return((FillingMode == 0 || (Type >= ORDER_FILLING_RETURN) || ((FillingMode & (Type + 1)) != Type + 1)) ?
          (((ExeMode == SYMBOL_TRADE_EXECUTION_EXCHANGE) || (ExeMode == SYMBOL_TRADE_EXECUTION_INSTANT)) ?
           ORDER_FILLING_RETURN : ((FillingMode == SYMBOL_FILLING_IOC) ? ORDER_FILLING_IOC : ORDER_FILLING_FOK)) :
          (ENUM_ORDER_TYPE_FILLING)Type);
  }
 
JRandomTrader #:

SymbolInfoInteger(_Symbol,SYMBOL_FILLING_MODE) returns all allowed filling modes, but you need to specify one specific one of the allowed ones in the request.

Thanks for this.
Reason: