Errors, bugs, questions - page 2100

 
Slava:

You have sensed the difference between a synchronous command and an asynchronous one.

Could you provide a list of asynchronous functions.

If I understand correctly, Object and Chart functions (which others?) are all asynchronous. Then it's not quite clear why ChartGet runs faster than ChartXY?

 
Slava:

You have sensed the difference between a synchronous command and an asynchronous command.

Yeah...
But observations show that these functions are quite synchronous in their asynchrony. :)
Ok, I'll formulate my question differently for developers: Is there an opportunity (or desire) to change these asynchronous functions into synchronous ones?
 
fxsaber:

Could you provide a list of asynchronous functions.

If I understand correctly, Object and Chart functions (which others?) are all asynchronous. Then it is not quite clear why ChartGet runs faster than ChartXY?

They're also terribly slow, it's just that the point of my "fast" algorithm is to calculate an opportunity not to call chart functions and do without them. And as soon as you "grab" chart in my example and start moving it left - right, all speed is lost because chart functions start to be applied due to occurrence of event
CHARTEVENT_CHART_CHANGE
 

Hello, I started studying MQL5 fromhttps://www.mql5.com/ru/articles/100. I have launched the code and received error 4756. The error has not improved after looking through documentation. Ok, thought I will start with simple functions (Alert/Print...). One of the most important functions is OrderSend. I started searching through the forum/documentation on how to use OrderSend. I found this articlehttps://www.mql5.com/ru/docs/constants/tradingconstants/enum_trade_request_actions and found the code for opening a Buy position. I got error 4756 and retcode 10030. I understood that 10030 - it is the OrderSend property, but I have not understood how this property should be used (I looked at somebody else's code) and what it is mainly used for. Then I openedhttps://www.mql5.com/ru/docs/trading/ordersend, copied the code, launched it, everything is fine, it worked.
But I still don't understand why error 4756 appears and how to get rid of it, as well as 10030.

Looked at the code between

void OnTick(){
      //--- объявление и инициализация запроса и результата
      MqlTradeRequest request={0};
      MqlTradeResult  result={0};
      //--- параметры запроса
      request.action   =TRADE_ACTION_DEAL;                     // тип торговой операции
      request.symbol   =Symbol();                              // символ
      request.volume   =0.1;                                   // объем в 0.1 лот
      request.type     =ORDER_TYPE_BUY;                        // тип ордера
      request.price    =SymbolInfoDouble(Symbol(),SYMBOL_ASK); // цена для открытия
      request.deviation=5;                                     // допустимое отклонение от цены
      request.magic    =EXPERT_MAGIC;                          // MagicNumber ордера
      //--- отправка запроса
      if(!OrderSend(request,result))
         PrintFormat("OrderSend error %d",GetLastError());     // если отправить запрос не удалось, вывести код ошибки
         Alert(GetLastError());
      //--- информация об операции
      PrintFormat("retcode=%u  deal=%I64u  order=%I64u",result.retcode,result.deal,result.order);
   }

and this one.

uint SendRandomPendingOrder(long const magic_number) 
  { 
//--- готовим запрос 
   MqlTradeRequest request={0}; 
   request.action=TRADE_ACTION_PENDING;         // установка отложенного ордера 
   request.magic=magic_number;                  // ORDER_MAGIC 
   request.symbol=_Symbol;                      // инструмент 
   request.volume=0.1;                          // объем в 0.1 лот 
   request.sl=0;                                // Stop Loss не указан 
   request.tp=0;                                // Take Profit не указан    
//--- сформируем тип ордера 
   request.type=GetRandomType();                // тип ордера 
//---сформируем цену для отложенного ордера 
   request.price=GetRandomPrice(request.type);  // цена для открытия 
//--- отправим торговый приказ 
   MqlTradeResult result={0}; 
   OrderSend(request,result); 
//--- выведем в лог ответ сервера   
   Print(__FUNCTION__,":",result.comment); 
   if(result.retcode==10016) Print(result.bid,result.ask,result.price); 
//--- вернем код ответа торгового сервера 
   return result.retcode; 
  } 

They seem almost identical to me, I don't see where these errors appear (4756 and 10030). Please point the finger and explain.

 
damirqa:

Hello! I started studying MQL5 fromhttps://www.mql5.com/ru/articles/100. I have launched the code and received error 4756. So I thought I would start from the simplest one (Alert/Print...). One of the most important functions is OrderSend. I started searching through the forum/documentation on how to use OrderSend. I found this articlehttps://www.mql5.com/ru/docs/constants/tradingconstants/enum_trade_request_actions and found the code for opening a Buy position. I got error 4756 and retcode 10030. I understood that 10030 - it is the OrderSend property, but I have not understood how this property should be used (I looked at somebody else's code) and what it is mainly used for. Then I openedhttps://www.mql5.com/ru/docs/trading/ordersend, copied the code, launched it, everything is fine, it worked.
But I still don't understand why error 4756 appears and how to get rid of it, as well as 10030.

Looked at the code between

and this one.

They seem almost identical to me, I don't see where these errors appear (4756 and 10030). Please point the finger and explain


Use the CTrade trade class - that way you are guaranteed to make as few errors as possible.

Example of sending a trade order to open Buy:

//+------------------------------------------------------------------+
//|                                                     Open Buy.mq5 |
//|                              Copyright © 2018, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2018, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.000"
//---
#include <Trade\Trade.mqh>
CTrade         m_trade;                      // trading object
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   m_trade.Buy(1.0); // open Buy position, volume 1.0 lot
  }
//+------------------------------------------------------------------+
Files:
Open_Buy.mq5  2 kb
 
Vladimir Karputov:

Use the CTrade trade class to ensure that you make as few mistakes as possible.

Example of sending a trade order to open a Buy:


CTrade - is it a universal class? That is, it can replace any other code?

 
damirqa:

CTrade - is it a universal class? So, is it possible to replace any other code with it?


CTrade is supplied with the terminal in theStandard Library->Trade Classes->CTrade.

 
damirqa:

They seem almost identical to me, I don't see where these errors appear (4756 and 10030). Please point the finger and explain

https://www.mql5.com/ru/search#!keyword=Unsupported%20filling%20mode

Поиск - MQL5.community
Поиск - MQL5.community
  • www.mql5.com
Поиск выполняется с учетом морфологии и без учета регистра. Все буквы, независимо от того, как они введены, будут рассматриваться как строчные. По умолчанию наш поиск показывает страницы...
 

An example from kodobase


There are several ways to get code into ME

  1. Load it directly from ME. This is probably handy for some people. But for me, not at all.
  2. Download the file to disk, copy it to MQL5 folder and open it in ME. Most often I use this inconvenient way.
  3. Press "view" button and copy (copying - CTRL+A and CTRL+C) and paste code into ME (CTRL+V). The fastest and most convenient way.
Is it reasonable to make the "copy" button as shown in the screenshot?

 

In the MT5 tester, the "Input field" object OBJ_EDIT does not allow to edit a value in it. Is it designed that way or is it a bug?

In terminals and MT4 tester it is editable, but in MT5 tester it is not, the value entered into it programmatically when creating the object disappears.