Errors, bugs, questions - page 1453

 
Vladislav Andruschenko:

the table, however, shows the following values:

Fill or Kill

SYMBOL_FILLING_FOK

1

This policy means that a deal can be executed only with the specified volume. If the necessary amount of a financial instrument is currently unavailable in the market, the order will not be executed. The required volume can be filled using several offers available on the market at the moment.

Immediate or Cancel

SYMBOL_FILLING_IOC

2

In this case a trader agrees to execute a deal with the volume maximally available in the market within that indicated in the order. In case the order cannot be filled completely, the available volume of the order will be filled, and the remaining volume will be canceled. The possibility of using IOC orders is determined at the trade server.

Return

No identifier

This policy is used only for market orders (Buy and Sell), limit and stop limit orders and only for the symbols with Market or Exchange execution. In case of partial filling a market or limit order with remaining volume is not canceled but processed further.

But there must be a data mix-up!

You haven't read the whole Help.

You can set more than one mode for each symbol through a combination of flags. The combination of flags is expressed by a logical OR (|) operation , e.g. SYMBOL_FILLING_FOK|SYMBOL_FILLING_IOC. To check whether a particular mode is allowed for an instrument, the result of the logical AND (&) must be compared with the mode flag.

 

For symbols, the SYMBOL_FILLING_MODE property means a combination of flags - i.e. it describes which filling modes are allowed when trading that symbol.

Have you tried doing the check as written in the documentation?

В режимах исполнения "По запросу" и "Немедленный" для рыночных ордеров всегда используется политика заполнения Все/Ничего, а для лимитных ордеров - режим "Вернуть". В данном случае, при от отсылке ордеров функциями OrderSend или OrderSendAsync тип заполнения для них можно не указывать.

In the "By Market" and "Exchange" execution modes, the "Return" fill policy is always allowed for all order types. The permissibility of the other order types can be checked using SYMBOL_FILLING_FOK and SYMBOL_FILLING_IOC properties.

Example:

//+------------------------------------------------------------------+
//| checks the permissibility of the specified filling mode |
//+------------------------------------------------------------------+
bool IsFillingTypeAllowed(string symbol,int fill_type)
{
//--- get the value of the property describing the filling mode
int filling=(int)SymbolInfoInteger(symbol,SYMBOL_FILLING_MODE);
//--- return true if fill_type mode is enabled
return((filling&fill_type)==fill_type);
}


 
Rashid Umarov:

For symbols, the SYMBOL_FILLING_MODE property means a combination of flags - i.e. it describes which filling modes are allowed when trading that symbol.

Have you tried doing the check as written in the documentation?


The following solution worked

         switch((int)SymbolInfoInteger(Symbol(), SYMBOL_FILLING_MODE))
   {
   case SYMBOL_FILLING_FOK:
      request.type_filling=ORDER_FILLING_FOK;
      break;
   case SYMBOL_FILLING_IOC:
      request.type_filling=ORDER_FILLING_IOC;
      break;
   default:
      request.type_filling=ORDER_FILLING_RETURN;
   }
 
Vladislav Andruschenko:

this solution helped

If you read the help more carefully, you will see that the case when both modes are available is not handled - the value of SymbolInfoInteger will be(SYMBOL_FILLING_FOK | SYMBOL_FILLING_IOC).
 

And you can check it on "RoboForex-MetaTrader 5" server with this code:

//+------------------------------------------------------------------+
//|                                                 Info_FILLING.mq5 |
//|                        Copyright 2015, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2015, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property description "Варианты исполнения ордера по объему"
#include<Trade\Trade.mqh>
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
// Все/Ничего     SYMBOL_FILLING_FOK   1
// Все/Частично   SYMBOL_FILLING_IOC   2
// Вернуть        Идентификатор отсутствует
   Print("Все/Ничего: ",IsFillingTypeAllowed(Symbol(),SYMBOL_FILLING_FOK));
   Print("Все/Частично: ",IsFillingTypeAllowed(Symbol(),SYMBOL_FILLING_IOC));
   Print("Вернуть: ",IsFillingTypeAllowed(Symbol(),NULL));

   CTrade oTrade;
   switch((int)SymbolInfoInteger(Symbol(),SYMBOL_FILLING_MODE))
     {
      case SYMBOL_FILLING_FOK:
         Print("ORDER_FILLING_FOK");
         break;
      case SYMBOL_FILLING_IOC:
         Print("ORDER_FILLING_IOC");
         break;
      default:
         Print("ORDER_FILLING_RETURN");
     }
  }
//+------------------------------------------------------------------+ 
//| проверяет разрешенность указанного режима заполнения             | 
//+------------------------------------------------------------------+ 
bool IsFillingTypeAllowed(string symbol,int fill_type)
  {
//--- получим значение свойства, описывающего режим заполнения 
   int filling=(int)SymbolInfoInteger(symbol,SYMBOL_FILLING_MODE);
//--- вернем true, если режим fill_type разрешен 
   return((filling&fill_type)==fill_type);
  }
//+------------------------------------------------------------------+

And the result of the switch:

2015.12.22 18:13:09.946 Info_FILLING (AUDCAD.m,D1)      Все/Ничего: true
2015.12.22 18:13:09.946 Info_FILLING (AUDCAD.m,D1)      Все/Частично: true
2015.12.22 18:13:09.946 Info_FILLING (AUDCAD.m,D1)      Вернуть: true
2015.12.22 18:13:09.946 Info_FILLING (AUDCAD.m,D1)      ORDER_FILLING_RETURN


You can see that the switch variant is not telling us the truth. But here is an example from the documentation that gives us the full picture.

 

What's the problem with

MarketInfo(Symbol(),MODE_MARGININIT) and SymbolInfoDouble(Symbol(),SYMBOL_MARGIN_INITIAL)

Why do they return zeros ?????

 
Vladimir Pastushak:

What's the problem with

MarketInfo(Symbol(),MODE_MARGININIT) and SymbolInfoDouble(Symbol(),SYMBOL_MARGIN_INITIAL)

Why do they return zeroes ??????

I've been waiting for six months for a help desk with a problem with margin calculation. The information in the help desk does not match the information on the site the information in the help desk and on the site does not match the actual information.

Collateral Calculation

Errors,MetaTrader 5 MQL5,Opened,Started: 2015.07.13 16:23,#1259415

Here is an example from MQL5 help :

SYMBOL_CALC_MODE_FOREX

Forex mode - profit and margin calculation for Forex

Margin:Lots*Contract_Size/Leverage

This is a formula for calculating a forward quotation. The reverse quotation will be different for the cross, and the third one for the cross. The site has the same error.

So, whichever market type you take, the formulas are quite dubious...

And I found out today that MarketInfo(Symbol(),MODE_MARGININIT) and SymbolInfoDouble(Symbol(),SYMBOL_MARGIN_INITIAL) return zeros.

But on this resource there are also strange writings, https://metaquotes5.wordpress.com/2012/08/ as far as I understand it is MetaQuotes blog.

What are Expert Magic Numbers?
  • 2012.08.11
  • skebanga
  • metaquotes5.wordpress.com
Expert magic numbers are ids given to a particular expert advisor. Care should be taken to ensure the ids are unique. This is because the magic number is used by the MetaTrader back end to know which expert advisor to send information to. For example, when a trade notification is...
 
There are enemies all around. No one wants us except our women on payday.
 
Алексей Тарабанов:
There are enemies everywhere. No one needs us but our women on payday.

Greetings Alexey

If you can rewrite indicator iPulsar on MT5, please rewrite it in code base

Thank you


 

Hello colleagues!

Sorry, I made a mess on the main thread before I saw this one.

Please advise how to solve this problem: MT5 Expert Advisor on FORTS keeps showing error 10022: "Invalidorder expiry date in request" when placing BAY_STOP or SELL_STOP orders.

The date of expiry is not important to me, but I cannot find any parameters which will just set the order. We don't have such a problem in forex. My broker is OPEN. The error occurs in the tester.


Reason: