Errors, bugs, questions - page 2019

 
fxsaber:

It has been written about many times. Not corrected for some reason.

I've seen it written before about arrows not always being able to be displayed immediately after a transaction. I opened such an application as well. But to have such omissions in the list on the History tab, haven't seen any posts yet.

P.S. And yes, after providing evidence and all the necessary data to reproduce the bug, for some reason a complete ignore for a whole week, although from the beginning responded, refusing to agree that there is a bug.

 
Anatoli Kazharski:

I've seen it written before that the arrows may not always show up immediately after a trade. I opened such an application as well. But I haven't seen such omissions in the list on the History tab yet.

You need to switch tabs several times, then the history becomes correct. It is very unpleasant during debugging.

 
fxsaber:

The tabs have to be switched several times, then the history becomes correct. It is very annoying during debugging.

Yes, it is very annoying in some cases when developing and debugging trading strategies.

I haven't noticed that switching the tabs has somehow changed the contents of the history list:


 
Anatoli Kazharski:

I haven't noticed that switching tabs somehow changes the contents of the history list:

Right click and change Deals/Order.

 
Anatoli Kazharski:

Yes, this is a big hindrance in some cases when developing and debugging trading strategies.

I have not noticed that switching tabs has changed the contents of the history list in any way:


There is such a thing. I save myself with a speed slider and a pause.
 
fxsaber:

Right-click and change Transactions/Order.

Yes, such actions restore the list of transaction history:


 
Comments not related to this topic have been moved to "Questions from MQL4 MT4 MetaTrader 4 beginners".
 
All real symbols in the account are in the form "EURUSD.hello". After creating a custom "EURUSD" will there be no problems when copying from the Signals service?
 

Please add the following values

ENUM_DEAL_REASON

Identifier

Description

DEAL_REASON_LIMIT

Deal was executed as a result of a limit order triggering

DEAL_REASON_MARKET

Deal was executed as a result of market order triggering

DEAL_REASON_STOP

The deal was executed as a result of a stop order triggering


It seems to be unnecessary. But there are situations in which the order was partially executed, creating a deal,in which case DEAL_ORDER will be found, but it will not be in the history table, since the order is still alive.

In other words, to find out the type of order, which caused the deal, it is not always helpful to refer to the order history. If we don't want to make a mess with searching for orders amongst the "dead and alive" ones, we can simply add more flags of execution (after existing flags) in order to maintain compatibility with ENUM_ORDER_REASON andENUM_POSITION_REASON. At the same time it is desirable to add the same flags toENUM_POSITION_REASON to be compatible

POSITION_REASON_LIMIT  == DEAL_REASON_LIMIT
POSITION_REASON_MARKET == DEAL_REASON_MARKET
POSITION_REASON_STOP   == DEAL_REASON_STOP
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства сделок
Документация по MQL5: Стандартные константы, перечисления и структуры / Торговые константы / Свойства сделок
  • www.mql5.com
Сделка является отражением факта совершения торговой операции на основании ордера, содержащего торговый приказ. Каждая сделка описывается свойствами, позволяющими получить информацию о ней. Для чтения значений свойств используются функции вида Идентификатор позиции, в открытии, изменении или закрытии которой участвовала эта сделка. Каждая...
 

A question about OrderCalcMargin came up in a neighbouring threadhttps://www.mql5.com/ru/forum/216697/page3


Test: let's check 2 different ways of calculating the deposit by substituting different opening prices.

#define  TOSTRING(A) #A+" = "+(string)(A)
void OnStart()
  {
   double margin_1=999,price_1;

   Print(TOSTRING(price_1=SymbolInfoDouble(Symbol(),SYMBOL_ASK)));
   Print("price_1= ",price_1," margin_1= ",NormalizeDouble(margin_1,8)," ",TOSTRING(OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1)));
   Print("price_1= ",price_1," margin_1= ",NormalizeDouble(margin_1,8)," ",TOSTRING(MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1)));
   Print(TOSTRING(price_1=SymbolInfoDouble(Symbol(),SYMBOL_BID)));
   Print("price_1= ",price_1," margin_1= ",NormalizeDouble(margin_1,8)," ",TOSTRING(OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1)));
   Print("price_1= ",price_1," margin_1= ",NormalizeDouble(margin_1,8)," ",TOSTRING(MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1)));
   Print(TOSTRING(price_1=10.0));
   Print("price_1= ",price_1," margin_1= ",NormalizeDouble(margin_1,8)," ",TOSTRING(OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1)));
   Print("price_1= ",price_1," margin_1= ",NormalizeDouble(margin_1,8)," ",TOSTRING(MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1)));
   Print(TOSTRING(price_1=1.0));
   Print("price_1= ",price_1," margin_1= ",NormalizeDouble(margin_1,8)," ",TOSTRING(OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1)));
   Print("price_1= ",price_1," margin_1= ",NormalizeDouble(margin_1,8)," ",TOSTRING(MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1)));
  }

// Альтернатива OrderCalcMargin
bool MyOrderCalcMargin(const ENUM_ORDER_TYPE action,const string symbol,const double volume,const double price,double &margin)
  {
   double MarginInit,MarginMain;

   const bool Res=SymbolInfoMarginRate(symbol,action,MarginInit,MarginMain);

   margin=Res ? MarginInit*price*volume*SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_VALUE)/
          (SymbolInfoDouble(symbol,SYMBOL_TRADE_TICK_SIZE)*AccountInfoInteger(ACCOUNT_LEVERAGE)) : 0;

   return(Res);
  }

Here is the LOG

LF      0       04:28:05.464    test (AUDJPY,H1)        price_1=SymbolInfoDouble(Symbol(),SYMBOL_ASK) = 88.712
KP      0       04:28:05.464    test (AUDJPY,H1)        price_1= 88.712 margin_1= 26.19 OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
CR      0       04:28:05.464    test (AUDJPY,H1)        price_1= 88.712 margin_1= 26.19399834 MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
ED      0       04:28:05.464    test (AUDJPY,H1)        price_1=SymbolInfoDouble(Symbol(),SYMBOL_BID) = 88.7
PR      0       04:28:05.464    test (AUDJPY,H1)        price_1= 88.7 margin_1= 26.19 OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
KS      0       04:28:05.464    test (AUDJPY,H1)        price_1= 88.7 margin_1= 26.1904551 MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
EP      0       04:28:05.464    test (AUDJPY,H1)        price_1=10.0 = 10.0
HK      0       04:28:05.464    test (AUDJPY,H1)        price_1= 10.0 margin_1= 26.19 OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
HH      0       04:28:05.464    test (AUDJPY,H1)        price_1= 10.0 margin_1= 2.95270069 MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
KN      0       04:28:05.464    test (AUDJPY,H1)        price_1=1.0 = 1.0
FS      0       04:28:05.464    test (AUDJPY,H1)        price_1= 1.0 margin_1= 26.19 OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
PR      0       04:28:05.464    test (AUDJPY,H1)        price_1= 1.0 margin_1= 0.29527007 MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true

The OrderCalcMargin function doesn't consider the opening price when calculating the margin

This seems to be related to the exchange rate of the quoted currency, which has to be recalculated for the time and opening price.

If the quoted currency is USD (and the account currency is also USD), then the calculated margin will change according to the opening price.

Log for GBPUSD

KK      0       05:25:15.763    test (GBPUSD,H1)        price_1=SymbolInfoDouble(Symbol(),SYMBOL_ASK) = 1.32354
CR      0       05:25:15.763    test (GBPUSD,H1)        price_1= 1.32354 margin_1= 44.12 OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
DD      0       05:25:15.763    test (GBPUSD,H1)        price_1= 1.32354 margin_1= 44.118 MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
GD      0       05:25:15.763    test (GBPUSD,H1)        price_1=SymbolInfoDouble(Symbol(),SYMBOL_BID) = 1.32341
LS      0       05:25:15.763    test (GBPUSD,H1)        price_1= 1.32341 margin_1= 44.11 OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
NQ      0       05:25:15.763    test (GBPUSD,H1)        price_1= 1.32341 margin_1= 44.11366667 MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
DG      0       05:25:15.763    test (GBPUSD,H1)        price_1=10.0 = 10.0
LM      0       05:25:15.763    test (GBPUSD,H1)        price_1= 10.0 margin_1= 333.33 OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
NO      0       05:25:15.763    test (GBPUSD,H1)        price_1= 10.0 margin_1= 333.33333333 MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
HM      0       05:25:15.763    test (GBPUSD,H1)        price_1=1.0 = 1.0
ED      0       05:25:15.763    test (GBPUSD,H1)        price_1= 1.0 margin_1= 33.33 OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true
OD      0       05:25:15.763    test (GBPUSD,H1)        price_1= 1.0 margin_1= 33.33333333 MyOrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1) = true

Is it a Bug or should it be?

OrderCalcMargin и проблема с ним связанная.
OrderCalcMargin и проблема с ним связанная.
  • 2017.10.04
  • www.mql5.com
Один советник работает на счёте MetaQuotes-Demo на семи валютных парах и на трёх парах реальном счёте робо. Итого 10 экземпляров советника запущено...