Erreurs, bugs, questions - page 2019

 
Anatoli Kazharski:

J'ai déjà vu qu'il était écrit que les flèches n'apparaissent pas toujours immédiatement après une transaction. J'ai également ouvert une telle application. Mais je n'ai pas encore vu de telles omissions dans la liste de l'onglet Historique.

Vous devez changer d'onglet plusieurs fois, puis l'historique devient correct. C'est très désagréable pendant le débogage.

 
fxsaber:

Les onglets doivent être changés plusieurs fois, puis l'historique devient correct. C'est très ennuyeux pendant le débogage.

Oui, c'est très gênant dans certains cas lors du développement et du débogage de stratégies de trading.

Je n'ai pas remarqué que le fait de changer d'onglet a modifié d'une manière ou d'une autre le contenu de la liste de l'historique :


 
Anatoli Kazharski:

Je n'ai pas remarqué que le fait de changer d'onglet modifie en quelque sorte le contenu de la liste de l'historique :

Cliquez avec le bouton droit de la souris et modifiez les offres/commandes.

 
Anatoli Kazharski:

Oui, c'est un gros obstacle dans certains cas lors du développement et du débogage de stratégies de trading.

Je n'ai pas remarqué que le fait de changer d'onglet a modifié le contenu de la liste de l'historique de quelque manière que ce soit :


Ça existe. Je me sauve avec un curseur de vitesse et une pause.
 
fxsaber:

Faites un clic droit et changez Transactions/Ordre.

Oui, ces actions restaurent la liste de l'historique des transactions :


 
Les commentaires non liés à ce sujet ont été déplacés vers "Questions des débutants de MQL4 MT4 MetaTrader 4".
 
Tous les symboles réels du compte sont sous la forme "EURUSD.hello". Après avoir créé un "EURUSD" personnalisé, n'y aura-t-il pas de problèmes lors de la copie à partir du service de signaux?
 

Veuillez ajouter les valeurs suivantes

ENUM_DEAL_REASON

Identifiant

Description

LIMITE DE LA RAISON DE LA TRANSACTION

La transaction a été exécutée à la suite du déclenchement d'un ordre à cours limité.

MARCHÉ_RAISONNABLE

La transaction a été exécutée à la suite du déclenchement d'un ordre de marché.

DEAL_REASON_STOP

La transaction a été exécutée suite à un ordre stop déclenchant


Il semble que ce soit inutile. Mais il y a des situations dans lesquelles l'ordre a été partiellement exécuté, créant une transaction,dans ce cas DEAL_ORDER sera trouvé, mais il ne sera pas dans la table d'historique, puisque l'ordre est toujours vivant.

En d'autres termes, pour trouver le type de commande à l'origine de la transaction, il n'est pas toujours utile de se référer à l'historique des commandes. Si l'on ne veut pas semer la pagaille en recherchant les ordres parmi les ordres "morts et vivants", on peut simplement ajouter d'autres drapeaux d'exécution - après ceux qui existent déjà, afin de maintenir la compatibilité avec ENUM_ORDER_REASON etENUM_POSITION_REASON. En même temps, il est souhaitable d'ajouter les mêmes drapeaux àENUM_POSITION_REASON pour être compatible.

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

Une question sur OrderCalcMargin a été soulevée dans un fil de discussion voisinhttps://www.mql5.com/ru/forum/216697/page3.


Test : vérifions 2 façons différentes de calculer le dépôt en substituant différents prix d'ouverture.

#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);
  }

Voici le 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

La fonction OrderCalcMargin ne prend pas en compte le prix d'ouverture lors du calcul de la marge.

Cela semble être lié au taux de change de la devise cotée, qui doit être recalculé pour l'heure et le prix d'ouverture.

Si la devise cotée est l'USD (et que la devise du compte est également l'USD), la marge calculée changera en fonction du prix d'ouverture.

Journal pour 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

Est-ce un bug ou devrait-il l'être ?

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

La fonction OrderCalcMargin ne prend pas en compte le prix d'ouverture lors du calcul de la marge.

Est-ce un bug ou devrait-il l'être ?

Bien sûr que c'est un bug. Écriture sur le SD.

Print("price_1= ",price_1," margin_1= ",NormalizeDouble(margin_1,8)," ",TOSTRING(OrderCalcMargin(ORDER_TYPE_BUY,_Symbol,0.1,price_1,margin_1)));

Cette ligne fonctionne comme elle le devrait, mais j'ai dû vérifier car je dois deviner l'ordre d'exécution. Discussion sur ce point ici.

Raison: