There, a file <Inform.mqh> is included in the program.
""""""
A separate output subwindow is created using a custom indicator with appropriate settings. The only purpose of this indicator is to create a subwindow, therefore, no calculations are performed in the indicator, there is also no purpose to create indicator lines. The code of the indicator Inform.mq4 may look as follows:
//-------------------------------------------------------------------- // Inform.mq4 // Предназначен для использования в качестве примера в учебнике MQL4. //-------------------------------------------------------------------- #propertyindicator_separate_window// Отдельное окно индикатора //-------------------------------------------------------------------- intstart()// Специальная функция start() { } //--------------------------------------------------------------------
In general, the programmer can add the necessary code to the indicator, thereby providing it with additional properties. For example, in some part of the indicator subwindow, you can display the indicator lines. This example shows a simple code of an indicator, the window of which will display the graphical objects.
""""
Here is the code of the Inform file. I don't understand how to get signals from it on the chart. In the program it works, it seems to give out commands on the chart, but nothing... I need to attach an Inform indicator and write something in it? Or another way?
First, a little bit of theory. An MQL program is... program. That is, it cannot perform operations that it is not told to perform. In the "program execution" help section you can read that when a new tick comes in the Expert Advisor/indicator, the start() function is executed. If the Inform() function is not called from the start() function, it will not be executed. Now read further the article from the section you have mentioned: The Inform() function can be called from any place in the program where it is necessary to print the next message. I.e., in function start(), where we need to print the message, we write
Thanks for the explanation, of course, but it is called from the program often, in the main body it is not present, but in other iclude it is everywhere and is called by sending messages, but they are not output(
as an example a line from Close_All.mqh
if (Tip==1) Price_Cls=Ask; // For Sell orders Inform(12,Ticket); // Message about attempted close.
int start() // Спец. функция start
{
Terminal(); // Функция учёта ордеров
Events(); // Информация о событиях
Trade(Criterion()); // Торговая функция
Inform(0); // Для перекрашивания объектов
return; // Выход из start()
}
It is essentially the same as in the tutorial. All calls come from include files .
Here's an example
//--------------------------------------------------------------------// Events.mqh// Предназначен для использования в качестве примера в учебнике MQL4.//--------------------------------------------------------------- 1 --// Функция слежения за событиями.// Глобальные переменные:// Level_new Новое значение минимальной дистанции// Level_old Предыдущее значение минимальной дистанции// Mas_Ord_New[31][9] Массив ордеров последний известный// Mas_Ord_Old[31][9] Массив ордеров предыдущий (старый)//--------------------------------------------------------------- 2 --int Events()// Пользовательская функция{bool Conc_Nom_Ord;// Совпадение ордеров в ..//.. старом и новом массивах//--------------------------------------------------------------- 3 --
Level_new=MarketInfo(Symbol(),MODE_STOPLEVEL);// Последн.известноеif( Level_old!= Level_new)// Новое не равно старому..{// значит изменились условия
Level_old= Level_new;// Новое "старое значение"
Inform(10, Level_new);// Сообщение: новая дистанц.}//--------------------------------------------------------------- 4 --// Поиск пропавших, поменявших тип, частично закрытых и переоткрытыхfor(int old=1; old<= Mas_Ord_Old[0][0]; old++)// По массиву старых{// Исходим из того, что..
Conc_Nom_Ord=false;// ..ордера не совпадают//--------------------------------------------------------- 5 --for(intnew=1;new<= Mas_Ord_New[0][0];new++)//Цикл по массиву ..{//..новых ордеров//------------------------------------------------------ 6 --if( Mas_Ord_Old[ old][4]== Mas_Ord_New[new][4])// Совпал номер {// Тип ордера стал ..if( Mas_Ord_New[new][6]!= Mas_Ord_Old[ old][6])//.. другим
Inform(7, Mas_Ord_New[new][4]);// Сообщение: преобраз.:)
Conc_Nom_Ord=true;// Ордер найден, ..break;// ..значит выходим из ..}// .. внутреннего цикла//------------------------------------------------------ 7 --// Не совпал номер ордераif( Mas_Ord_Old[ old][7]>0&&// MagicNumber есть, совпал
Mas_Ord_Old[ old][7]== Mas_Ord_New[new][7])//.. со старым{//значит он переоткрыт или частично закрыт// Если лоты совпадают,.. if( Mas_Ord_Old[ old][5]== Mas_Ord_New[new][5])
Inform(8, Mas_Ord_Old[ old][4]);// ..то переоткрытиеelse// А иначе это было..
Inform(9, Mas_Ord_Old[ old][4]);// ..частичное закрытие
Conc_Nom_Ord=true;// Ордер найден, ..break;// ..значит выходим из ..}// .. внутреннего цикла}//--------------------------------------------------------- 8 --if( Conc_Nom_Ord==false)// Если мы сюда дошли,..{// ..то ордера нет:(if( Mas_Ord_Old[ old][6]==0)
Inform(1, Mas_Ord_Old[ old][4]);// Ордер Buy закрытif( Mas_Ord_Old[ old][6]==1)
Inform(2, Mas_Ord_Old[ old][4]);// Ордер Sell закрытif( Mas_Ord_Old[ old][6]>1)
Inform(3, Mas_Ord_Old[ old][4]);// Отложен. ордер удалён}}//--------------------------------------------------------------- 9 --// Поиск новых ордеров for(new=1;new<= Mas_Ord_New[0][0];new++)// По массиву новых орд.{if( Mas_Ord_New[new][8]>0)//Это не новый,а переоткрcontinue;//..или частично закрытый
Conc_Nom_Ord=false;// Пока совпадения нетfor( old=1; old<= Mas_Ord_Old[0][0]; old++)// Поищем этот ордерок {// ..в массиве старыхif( Mas_Ord_New[new][4]== Mas_Ord_Old[ old][4])//Совпал номер..{//.. ордера
Conc_Nom_Ord=true;// Ордер найден, ..break;// ..значит выходим из ..}// .. внутреннего цикла}if( Conc_Nom_Ord==false)// Если совпадения нет,..{// ..то ордер новый :)if( Mas_Ord_New[new][6]==0)
Inform(4, Mas_Ord_New[new][4]);// Ордер Buy открытif( Mas_Ord_New[new][6]==1)
Inform(5, Mas_Ord_New[new][4]);// Ордер Sell открытif( Mas_Ord_New[new][6]>1)
Inform(6, Mas_Ord_New[new][4]);// Установлен отлож.ордер}}//-------------------------------------------------------------- 10 --return;}//-------------------------------------------------------------- 11 --
I understand that you also have the Criterion() function from the example? Then wait until the criteria for opening a position triggered in accordance with the strategy described in the tutorial - and then you will see how the Inform() function works. Or open it manually using the corresponding button on the terminal - it should work too...
No, I put my Criterion) there was sense in running it all, but it didn't work even with initial one (now it's hard to rewrite everything back, but Criterion sends opening orders, deals open, events happen, but there are 0 messages in output...
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.
Looks like a week for us newbies is the deadline after which we go to you pros))))
Concluded from the last few posts....
let's get to the bottom of this:) state the context.
Context? simple...
Article Creating an ordinary program(https://book.mql4.com/ru/build/index) from the textbook.
There, a file <Inform.mqh> is included in the program.
""""""
A separate output subwindow is created using a custom indicator with appropriate settings. The only purpose of this indicator is to create a subwindow, therefore, no calculations are performed in the indicator, there is also no purpose to create indicator lines. The code of the indicator Inform.mq4 may look as follows:
In general, the programmer can add the necessary code to the indicator, thereby providing it with additional properties. For example, in some part of the indicator subwindow, you can display the indicator lines. This example shows a simple code of an indicator, the window of which will display the graphical objects.
""""
Here is the code of the Inform file. I don't understand how to get signals from it on the chart. In the program it works, it seems to give out commands on the chart, but nothing... I need to attach an Inform indicator and write something in it? Or another way?
Please tell me how to do it ((...)
Please tell us what to do((.
First, a little bit of theory. An MQL program is... program. That is, it cannot perform operations that it is not told to perform. In the "program execution" help section you can read that when a new tick comes in the Expert Advisor/indicator, the start() function is executed. If the Inform() function is not called from the start() function, it will not be executed. Now read further the article from the section you have mentioned: The Inform() function can be called from any place in the program where it is necessary to print the next message. I.e., in function start(), where we need to print the message, we write
Thanks for the explanation, of course, but it is called from the program often, in the main body it is not present, but in other iclude it is everywhere and is called by sending messages, but they are not output(
as an example a line from Close_All.mqh
int start() // Спец. функция start { Terminal(); // Функция учёта ордеров Events(); // Информация о событиях Trade(Criterion()); // Торговая функция Inform(0); // Для перекрашивания объектов return; // Выход из start() }It is essentially the same as in the tutorial. All calls come from include files .
Here's an example
It is essentially the same as in the tutorial. All calls come from include files .
Here's an example
The Inform is called a shitload of times, but it's hard to see how it displays.... where the messages go too(