Forum

Preprocessor regression in build 3950

There appears to be a regression in build 3950 (14 Sep 2023) in the behavior of the preprocessor. The code below compiles without errors on the old build 3802 (9 Jun 2023): #define NAME(prefix, linenr) prefix##linenr #define MAKE_VAR \ int NAME(example, __LINE__) = 123 void OnStart() {

Downsampling of ticks

I am using the MT5 platform and noticed I never receive ticks closer together than 200 ms even during high volatility. Not via the OnTick() method, nor via CopyTicks() or CopyTicksRange(). However, my orders get filled at prices that do not correspond to any of these ticks. This suggests the MT5

Two orders with the same ticket number

I am running two instances of the same EA on two VPSes in two different data-centers, each with a different magic number. Tonight both EAs placed the same buy stop order (with different magic numbers) using this code: CTrade trade; if (!trade.BuyStop(lotSize, entry, _Symbol , sl, tp, ORDER_TIME_GTC

Log critical errors

My EAs log diagnostic data in a text file. This helps me troubleshoot users problems, monitor the trade execution (slippage, server roundtrip delay), etc. Unfortunately, my EAs are not perfect and might cause a critical error (e.g. " array out of range "). It would be great if the EA would allow me

MqlTradeResult.price is zero after blocking OrderSend()

My EA opens positions at market price using OrderSend(). In the Strategy Tester, and on demo, when the call returns "10009 Request Completed", the MqlTradeResult .price field holds the price at which the position was opened, and the MqlTradeResult .deal field holds the corresponding deal ID

How to get take profit level of closed position?

To get the current TP of an open position (hedging mode), I use if ( PositionSelectByTicket (positionId)) { return PositionGetDouble ( POSITION_TP ); } Once the position is closed, I search for the corresponding ENTRY_IN deal, and query the corresponding order for the TP: if (