MetaTrader 5 on a live account - page 2

 
IgorM:

I meant the price, not the SL or TP? And at what price should the server open a market order for me, at the price it gave me or at the price I wanted?

why should i not send the server the price with a positive spread?)

WZZ: USDJPY : 82.49 ; 82.510000000001 ; 82.49 - maybe 82.55 at once ?

here's an example of sending a request with normalized prices

//+------------------------------------------------------------------+
//| Функция открытия ордеров                                         |
//+------------------------------------------------------------------+
void OpenOpders(string sym,ENUM_ORDER_TYPE type)
  {
   int n=0;
   bool res=true;
   while(res)
     {
      n++;
      Alert(n," - Попытка открыть ордер: ",TypeToStr(type)," на  ",sym,", Лот - ",Lots);
      double Bid=SymbolInfoDouble(sym,SYMBOL_BID);
      double Ask=SymbolInfoDouble(sym,SYMBOL_ASK);
      int digit=(int)SymbolInfoInteger(sym,SYMBOL_DIGITS);
      double price=0.0;

      if(type==ORDER_TYPE_BUY)price=NormalizeDouble(Ask,digit);
      else if(type==ORDER_TYPE_SELL)price=NormalizeDouble(Bid,digit);

      request.action       = TRADE_ACTION_DEAL;
      request.symbol       = sym;
      request.volume       = Lots;
      request.price        = price;
      request.deviation    = Slip;
      request.type         = type;
      request.type_filling = ORDER_FILLING_AON;

      OrderSend(request,result);

      switch(Fun_Error(result.retcode))
        {
         case 0:res=false;break;
         case 1:res=true;break;
         case 2:res=false;break;
        }
     }
  }
//+------------------------------------------------------------------+
//| Функция обработки ошибок                                         |
//+------------------------------------------------------------------+
int Fun_Error(int Error)
  {
   switch(Error)
     {
      case 10004: Alert("Реквота");return(1);
      case 10006: Alert("Запрос отвергнут");Sleep(3000);return(1);
      case 10007: Alert("Запрос отменен трейдером");Work=false;return(0);
      case 10008: Alert("Ордер размещен");return(2);
      case 10009: Alert("Заявка выполнена");return(2);
      case 10010: Alert("Заявка выполнена частично");return(2);
      case 10011: Alert("Ошибка обработки запроса");return(1);
      case 10012: Alert("Запрос отменен по истечению времени");return(1);
      case 10013: Alert("Неправильный запрос");Work=false;return(0);
      case 10014: Alert("Неправильный объем в запросе");Work=false;return(0);
      case 10015: Alert("Неправильная цена в запросе");Work=false;return(0);
      case 10016: Alert("Неправильные стопы в запросе");Work=false;return(0);
      case 10017: Alert("Торговля запрещена");Work=false;return(0);
      case 10018: Alert("Рынок закрыт");Work=false;return(0);
      case 10019: Alert("Нет достаточных денежных средств для выполнения запроса");Work=false;return(0);
      case 10020: Alert("Цены изменились");return(1);
      case 10021: Alert("Отсутствуют котировки для обработки запроса");Sleep(3000);return(1);
      case 10022: Alert("Неверная дата истечения ордера в запросе");Work=false;return(0);
      case 10023: Alert("Состояние ордера изменилось");return(2);
      case 10024: Alert("Слишком частые запросы");Work=false;return(0);
      case 10025: Alert("В запросе нет изменений");Sleep(3000);return(1);
      case 10026: Alert("Автотрейдинг запрещен сервером");Work=false;return(0);
      case 10027: Alert("Автотрейдинг запрещен клиентским терминалом");Work=false;return(0);
      case 10028: Alert("Запрос заблокирован для обработки");return(2);
      case 10029: Alert("Ордер или позиция заморожены");return(2);
      case 10030: Alert("Указан неподдерживаемый тип исполнения ордера по остатку");Work=false;return(0);
      case 10031: Alert("Нет соединения с торговым сервером");Sleep(3000);return(1);
      case 10032: Alert("Операция разрешена только для реальных счетов");Work=false;return(0);
      case 10033: Alert("Достигнут лимит на количество отложенных ордеров");return(2);
      case 10034: Alert("Достигнут лимит на объем ордеров и позиций для данного символа");return(2);
      default:    Alert("Ошибка № - ",Error);Work=false;return(0);
     }
  }
//+------------------------------------------------------------------+
//| Функция преоброзования типа ордера в строку                      |
//+------------------------------------------------------------------+
string TypeToStr(ENUM_ORDER_TYPE type)
  {
   switch(type)
     {
      case  ORDER_TYPE_BUY:  return("BUY");
      case  ORDER_TYPE_SELL: return("SELL");
     }
   return("");
  }
 
Renat:
That is, the thesis of "platform dampness" has not been confirmed in any way.

I have never mentioned the dampness of the platform - re-read my posts

I have made my comments on the subject - if you think they are unsubstantiated, let them be, but I think your company sells software for brokers on the MT5 platform

sergey1294:

here is an example of sending a request with normalised prices

thanks but i have a slightly different idea of trading and price i want to open an order at try to normalise 82.47,82.459999999999,82.47

I'm not sure that the server "invented" a price 82.46 because such a price was not recorded in its logs and if it is not the market price - I do not need it - let it stay on the server and not go through errors in my logs

 
IgorM:

I have never mentioned the dampness of the platform - re-read my posts

i made my comments on the subject - if you think they are groundless, so be it, but i think your company sells software for brokers on the mt5 platform

sps but i have a slightly different idea of trading and the price at which i want to open an order, try to normalize 82.47,82.459999999999,82.47

I'm not sure that the server "invented" a price 82.46 because such a price was not in his logs and if the price is not market - I do not need it - let it stay on the server and not go to my logs with errors

Unfortunately, you are not aware of the basic arithmetic of real numbers and their representation in computers. That is the root of your misunderstanding of "non-normalised" prices.

82.4599999999(9) is the double representation of 82.46

 
IgorM:

I have never mentioned the dampness of the platform - re-read my posts

i have made my comments on the subject - if you think they are unsubstantiated, so be it, but i think your company sells software for brokers on the mt5 platform

sps but i have a slightly different idea of trading and the price at which i want to open an order, try to normalize 82.47,82.459999999999,82.47

I'm not sure if the server will "invent" a price 82.46 as there is no such price in its logs and if it is not the market price I do not need it - let it stay on the server and not go with errors in my logs

You don't quite understand what your pricing ideas are, the accepted price has five or four decimal places, so you need to cut the price down to that decimal place.
 
Renat:

Unfortunately, you are not aware of the basic arithmetic of real numbers and their representation in computers. This is the root of your misunderstanding of "non-normalised" prices.

82.45999999(9) is the double representation of 82.46

OK, I'll find time to reread probably already forgotten material, i.e. such a price (82.45999999(9)) will be accepted by the trading server to open a market order?

sergey1294 Please pay attention to what the developers gave you as ready-made examples and classes, at least the developers provided CTrade class doesn't have NormalizeDouble() functions, as well as the examples in the MQL5 Reference / Trading Functions / OrderSend

I'm not going to invent and initially write the wrong programs if I've read the examples in the original source, in the MT4 Reference the OrderSend() example also contains no price normalization

 
IgorM:

OK, I'll find time to reread probably already forgotten by me, i.e. such a price (82.45999999(9)) will be accepted by the trading server to open a market order?

Yes, if it is the correct/existing price in the tick stream.


sergey1294 Please pay attention to what the developers gave you as ready-made examples and classes, at least the developers provided CTrade class doesn't have NormalizeDouble() functions, as well as the examples in the MQL5 Reference / Trading Functions / OrderSend

I'm not going to invent and initially write the wrong programs if I've read concrete examples in the source

If you use the regular Bid and Ask for making trades, they are always normalized. Calculated prices (e.g. stops) need to be normalised before sending a trade order.

Standard CTrade methods don't normalize forcibly the incoming prices of orders, because it's categorically unacceptable - you can't substitute the prices declared above the level.

 
Renat:
Yes, as long as it is the correct/existing price in the tick stream.


If you use the regular Bid and Ask for trades, they are always normalised. But the calculated prices (e.g. stops) already need to be normalised yourself before sending a trade order.

Standard CTrade methods do not normalise the forced incoming bid prices as this is categorically unacceptable - you cannot substitute prices stated at a higher level.

cp! don't mind mentioning it several times in the MT5 handbook, so that there is no misunderstanding and you can immediately send to read the help :)

ZS: I know about SL and TR, but I don't remember or have read it in the help or figured it out on the forum

 
IgorM:

cp! if you would be so kind as to mention this several times in the MT5 handbook so that there is no misunderstanding and you can be sent straight to read the handbook :)

Yes, we are constantly upgrading the documentation and adding clarifications.
 
IgorM:

i read this forum all the time and very often i get amazed by your profound and informative posts ;)

As for the subject, I doubt that the quotes on demo accounts differ from microreal, but the demo accounts very often have non-normalized prices, the strong movement - you can not open or close the order by them, I would like to see some order, so that then do not blame MT5

As for taste and colour, it is a popular wisdom - non-normalized price bothers some people, although I personally do not consider it to be a big problem (as I use pending orders long time ago, and such prices are not a big problem for me). But the problem for me is such things as an unwillingness of OnTimer() to work in the tester or other similar things.

But even with these inputs, when choosing a terminal to trade on cent account (with a deposit of $200), I personally will make my choice in favor of MT5.

WITH ALL ITS CURRENT DISADVANTAGES!

 
Interesting:

Some people are bothered by "non-normalized price", but I personally do not think it is a big problem (because I've been using delays for a long time, and those prices are not that big a problem for me). But the problem for me is such things as unwillingness of OnTimer() to work in the tester or other similar things.

This error is a consequence of unsuccessful optimization and has been corrected in the new 358th build.