"Each such class has a common parent, the CNode class, which performs only one function, i.e. stores the type of the basic primitive.
Its only protected constructor requires type specification during element creation."
CNode class doesn't stores the type of the basic primitive. CEIChart does by m_obj_type member.
In new builds of the terminal (approximately since version 2170) there appeared a problem with the sources of the article ("Writing a scalper's glass"). In particular, the main file"MarketBook.mq5" generates critical errors during compilation:
' Event' - unexpected token, probably type is missing? MBookBtn.mqh 57 12
' Event' - function already defined and has different type MBookBtn.mqh 57 12
Could you please tell me what is wrong and how to fix it?
P.S. now checked"MarketBook.mq5" from an old article from 2015. It turned out that the same kind of errors occur with that project:
'Show' - unexpected token, probably type is missing? MBookFon.mqh 47 11 'Show' - function already defined and has different type MBookFon.mqh 47 11
In new builds of the terminal (approximately since version 2170) there appeared a problem with the sources of the article ("Writing a scalper's glass"). In particular, the main file"MarketBook.mq5" generates critical errors during compilation:
' Event' - unexpected token, probably type is missing? MBookBtn.mqh 57 12
' Event' - function already defined and has different type MBookBtn.mqh 57 12
Could you please tell me what is wrong and how to fix it?
The language is developing and the requirements are getting stricter.
Let's look at the file "MBookBtn.mqh", the declaration of the CMBookBtn class - the function Event is declared as void
//+------------------------------------------------------------------+//|| The class represents the button at the top of the graph, which, when clicked |//| A panel with a tick chart and a table of orders is displayed. ||//| Pressing the button again hides the panel. ||//+------------------------------------------------------------------+class CMBookBtn : public CElButton
{
private:
CMBookArea m_book_area;
bool m_showed_book;
public:
CMBookBtn();
void SetMarketBookSymbol(string symbol);
void Refresh();
void Event(int id,long lparam,double dparam,string sparam);void Clear(void);
virtualvoid OnShow(void);
};
and now we look at the function itself in the class:
the second error says "'Event' - function already defined and has different type MBookBtn.mqh 57 12" - that is, the function was declared with type void and here it is without specifying the type.
Cure:
//+------------------------------------------------------------------+//|| Intercept the mouse click on our button. If the button after |//| click in the pressed state - show the panel. If in the || state//| pushing down - hide the panel|//+------------------------------------------------------------------+void CMBookBtn::Event(int id,long lparam,double dparam,string sparam)
{
- just add void before the function in the class body.
Now compile the ... Indicators\MarketBookArticle\MarketBook.mq5 - there are no errors and run it: the glass works.
Hi Vasiliy, thank you for your beautiful article. I'm new in the MQL5 world and I'm facing a challenge in order to try to run your code locally. I believe it is a very silly problem, but I'm not being able to solve it
When I try to compile your code from MarketBook.mq5 I got the error as you can see below.
Could you please tell me, is it possible to fix - remember the time of found index in MarketBook.mqh class ?
In this method we find the price index on which the maximum volume on the Ask and Bid side is standing.
I also want to know at what terminal time we got this index.
The structure of the glass
Gives us 4 parameters, but there is no time in it.
Who can point us in the direction of how to remember the time of the found index
There is no time, because the time of quote arrival in MQL5 cannot be learnt. The maximum that can be done is to remember the time at the moment of arrival of the OnBookEvent event, so remember it. Remembering the time of finding the tops of the stack is also pointless, you need the time of arrival of the price stack, not the time of finding its maximal index.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
CNode class doesn't stores the type of the basic primitive. CEIChart does by m_obj_type member.
Thanks Vasiliy
In new builds of the terminal (approximately since version 2170) there appeared a problem with the sources of the article ("Writing a scalper's glass").
' Event' - unexpected token, probably type is missing? MBookBtn.mqh 57 12In particular, the main file"MarketBook.mq5" generates critical errors during compilation:
' Event' - function already defined and has different type MBookBtn.mqh 57 12
Could you please tell me what is wrong and how to fix it?P.S. now checked"MarketBook.mq5" from an old article from 2015. It turned out that the same kind of errors occur with that project:
'Show' - unexpected token, probably type is missing? MBookFon.mqh 47 11
'Show' - function already defined and has different type MBookFon.mqh 47 11
In new builds of the terminal (approximately since version 2170) there appeared a problem with the sources of the article ("Writing a scalper's glass").
' Event' - unexpected token, probably type is missing? MBookBtn.mqh 57 12In particular, the main file"MarketBook.mq5" generates critical errors during compilation:
' Event' - function already defined and has different type MBookBtn.mqh 57 12
Could you please tell me what is wrong and how to fix it?The language is developing and the requirements are getting stricter.
Let's look at the file "MBookBtn.mqh", the declaration of the CMBookBtn class - the function Event is declared as void
and now we look at the function itself in the class:
the second error says "'Event' - function already defined and has different type MBookBtn.mqh 57 12" - that is, the function was declared with type void and here it is without specifying the type.
Cure:
- just add void before the function in the class body.
Now compile the ... Indicators\MarketBookArticle\MarketBook.mq5 - there are no errors and run it: the glass works.
The whole code, when I copy and paste it to compile, gives an error when compiling. Does anyone know of a solution?
Lucas, if the error is related to an unexpected token in the CMBookBtn class, the call to the CMBookBtn::Event function must be preceded by void.
That's what we had for the moment.
Hi Vasiliy, thank you for your beautiful article. I'm new in the MQL5 world and I'm facing a challenge in order to try to run your code locally. I believe it is a very silly problem, but I'm not being able to solve it
When I try to compile your code from MarketBook.mq5 I got the error as you can see below.
Can you please help me solve this problem?
Hello.
Can you please tell me if it is possible to fix - remember the time of the found index in the MarketBook.mqh class?
In this method we find the price index on which the maximum volume on the Ask and Bid sides is located.
I also want to know at what terminal time we got this index.
The structure of the stack
Gives us 4 parameters, but there is no time in it.
Who can guide me how to remember the time of the found index?
Hello.
Could you please tell me, is it possible to fix - remember the time of found index in MarketBook.mqh class ?
In this method we find the price index on which the maximum volume on the Ask and Bid side is standing.
I also want to know at what terminal time we got this index.
The structure of the glass
Gives us 4 parameters, but it doesn't have time.
Can anyone point me in the direction of how to remember the time of the found index?
inherit the structure and add an additional field to it to which you will add the tick time when filling it in
Hello.
Could you please tell me, is it possible to fix - remember the time of found index in MarketBook.mqh class ?
In this method we find the price index on which the maximum volume on the Ask and Bid side is standing.
I also want to know at what terminal time we got this index.
The structure of the glass
Gives us 4 parameters, but there is no time in it.
Who can point us in the direction of how to remember the time of the found index
There is no time, because the time of quote arrival in MQL5 cannot be learnt. The maximum that can be done is to remember the time at the moment of arrival of the OnBookEvent event, so remember it. Remembering the time of finding the tops of the stack is also pointless, you need the time of arrival of the price stack, not the time of finding its maximal index.