MQL5 Invalid price on trades on symbols >$1000 Help!

 

Hello everyone,

I have just spotted a huge problem with trade execution. I am trying to open a market order at SymbolInfoDouble(_Symbol,SYMBOL_BID); Bid/Ask price and on allcurrency pairs it is working fine. BUT if we go for a gold or basically anything which price is above 1000.000 we get an error invalid price! If the Bid price ends with 2 decimal digits like 1052.960, order will be opened, however if the price is 1052.962 or 3 decimal digits, the order turns to invalid price. And the error 4756

Because it is a market order i cannot use NormalizeDouble() as it gives an error of incorrect price and corrects it and 4756 again. How this pricing issue can be solved? Please help, i dont understand why Market order cannot be opened by Bid/Askk price ...

 

i use standard oop

   CTrade Trade;
   Trade.Sell/Buy
 
Georgiy Liashchenko:

Hello everyone,

I have just spotted a huge problem with trade execution. I am trying to open a market order at SymbolInfoDouble(_Symbol,SYMBOL_BID); Bid/Ask price and on allcurrency pairs it is working fine. BUT if we go for a gold or basically anything which price is above 1000.000 we get an error invalid price! If the Bid price ends with 2 decimal digits like 1052.960, order will be opened, however if the price is 1052.962 or 3 decimal digits, the order turns to invalid price. And the error 4756

Because it is a market order i cannot use NormalizeDouble() as it gives an error of incorrect price and corrects it and 4756 again. How this pricing issue can be solved? Please help, i dont understand why Market order cannot be opened by Bid/Askk price ...

 

i use standard oop

What code (BUY or SELL)? Which trading server you connect?
 
if(Trade.Buy(d_Volume,_Symbol,SymbolInfoDouble(_Symbol,SYMBOL_ASK),0,0,""))
              
if(Trade.Sell(d_Volume,_Symbol,SymbolInfoDouble(_Symbol,SYMBOL_BID),0,0,""))
              
Karputov Vladimir
:

What code (BUY or SELL)? Which trading server you connect?

MetaQuotes-Demo

particularly i get this bug with XAUUSD  if open price ends with 3 digits .321 and last not 0

 
Georgiy Liashchenko:

MetaQuotes-Demo

particularly i get this bug with XAUUSD  if open price ends with 3 digits .321 and last not 0

     1. SymbolInfoDouble:

Note

It is recommended to use SymbolInfoTick() if the function is used for getting information about the last tick. It may well be that not a single quote has appeared yet since the terminal is connected to a trading account. In such a case, the requested value will be indefinite.

In most cases, it is enough to use SymbolInfoTick() function allowing a user to receive the values of Ask, Bid, Last, Volume and the time of the last tick's arrival during a single call.

     2. Use the following code::

CTrade tr;
tr.Buy(d_Volume);
tr.Sell(d_Volume);
 

On the trading server MetaQuotes trading by "EUR USD" closed:

 disabled

Probably because of this, an error occurs.

 

P.S. Such behaviour I noticed only in the Strategy Tester. 

 
Karputov Vladimir:

On the trading server MetaQuotes trading by "EUR USD" closed:

 

Probably because of this, an error occurs.

 

P.S. Such behaviour I noticed only in the Strategy Tester. 

Thanks a lot