Codes

Reporting Memory Leaks in Strategy Tester for MetaTrader 5

Monitoring of memory leaks in the strategy tester

Forum

Margin Calculation - please help

Hi, I have a problem with margin calculation and would be very happy if someone can help. MT5 build 4885. MetaQuotes Demo Account Netting. Leverage is 1:500. Deposit currency is EUR. If I buy 1 Lot EURUSD all is like I expect: Margin is 200 like I expect. Buying another lot results in margin 400

Role Order Type Parameter in OrderCalcMargin

Hi, I'm wondering about the role of the order type parameter in the function OrderCalcMargin (FOREX mode). Please see the following script: void OnStart () { const double vol = 1.00 ; const double price = SymbolInfoDouble ( Symbol (), SYMBOL_BID ); ENUM_ORDER_TYPE type; double margin;

Netting Account: Question about Position Operations

Hi, I'm working on a netting account. As far as I understand: by reversing an existing position the position will be closed and a new one will be opened with a new id and the contrarian type (buy --> sell or sell --> buy). Am I correct here? But I have difficulties to access to the newly opened

Proposition for reporting MEMORY LEAKS in strategy tester

Hi - happy New Year. In https://www.mql5.com/en/forum/383008#comment_26181711 I wondered why the strategy tester does not report any memory leaks if occurring in the MQL5 program. Look the following EA where I "forgot" to free the allocated memory: class A { private : string m_name; public : A(

Cannot close open orders and positions at EA termination

Hi, I have an EA which will close all open orders and positions in the OnDeinit function. This works fine if if I change the timeframe of the chart the EA is attached to. But if I remove the EA from the chart the OnDeinit function will be called; but cannot close the open orders and positions, the

Buy Limit Pending order is not triggered

Hi, today I stumbled on a problem with pending orders. Please see the following EA doing the following steps: trading the currency pair USDCHF as soon as the market is open two buy limit pendig orders will be placed: at 1.06800 and 1.06500 #include <Trade/Trade.mqh> bool OrderOpened; bool

Strange (incorrect?) behaviour of PrintFormat / StringFormat. Need help

Hi, today I stumbled across a very strange (or incorrect?) behaviour of the functions PrintFormat and/or StringFormat . Please see the following script: void OnStart () { double margin = 63.0 ; ENUM_ORDER_TYPE otype = ORDER_TYPE_BUY ; PrintFormat ( "wrong %s %s" , StringFormat

Commission is not displayed in deposit currency

Hi, I have a commission based forex account (Axiory-Demo). My deposit currency is EUR. Nevertheless in the specification of an arbitrary currency pair (eg GBPCHF) the commission value (for in_deal in this case) is shown in USD, not in my deposit currency. That is what I expect. Or am I completely

Suspicious account

Hi, after two weeks in holidays I restarted the MetaTrader trading software. But strange things happened: all connections to the broker servers are lost Instead I see a very suspect account which I cannot delete: Any ideas what happened here? Matthias

Explanation of Metatrader log file

Hi, could anybody explain the contents of the Metatrader log file, please? Especially the meaning of the two uppercase letters? Example: What is the meaning of 'MM', 'KF' etc.? Thanks Matthias MM 0 00 : 09 : 42.344 Startup access rights to common directory successfully checked KF