Questions from Beginners MQL4 MT4 MetaTrader 4 - page 8

 
Slawa:

The information about 8 buffers is outdated

In the new MQL4 you can set up to 512 buffers.

In order to understand it, see indicators source code in the folder MQL4\Indicators\Examples. And read documentation

Thanks, of course, for the link to the reference book:) However, I have already looked through it. Unfortunately, I haven't found anything specific - what do these additional buffers do, what is displayed, what isn't, etc. - just functions, and there is nothing about the structure and purpose of the new "buffers".

The man is asking for an answer on the forum, not for a link to a reference book. Maybe someone can explain in more detail ? :) Or at least a link to an article that explains it ?

 
Ilya Melamed:

Thanks, of course, for the link to the guide:) However, I've already looked through it. Unfortunately I have not found anything specific - what additional buffers are needed for, what is displayed, what is not, etc... just functions, but nothing on the structure and purpose, the logic of the updated "buffers".

The person is asking for an answer on the forum, not for a link to a reference book. Maybe someone can explain in more detail ? :) Or at least a link to an article where this is explained ?

Enjoy:

https://www.mql5.com/ru/articles/1500

https://www.mql5.com/ru/articles/1503

 
Ilya Melamed:

Thanks, of course, for the link to the guide:) However, I've already looked through it. Unfortunately I have not found anything specific - what additional buffers are needed for, what is displayed, what is not, etc... just functions, but nothing on the structure and purpose, the logic of the updated "buffers".

The man is asking for an answer on the forum, not for a link to a reference book. Maybe someone can explain in more detail ? :) Or at least a link to an article where it is explained ?

In the new mql4 you don't have to use additional buffers.

What you put in the buffer will be displayed. Maybe, nothing can be shown, if graph series type is DRAW_NONE.

The main function of the indicator is OnCalculate(). Start with it:

https://docs.mql4.com/ru/basis/function/events#oncalculate

Функции обработки событий - Функции - Основы языка - Справочник MQL4
Функции обработки событий - Функции - Основы языка - Справочник MQL4
  • docs.mql4.com
Функции обработки событий - Функции - Основы языка - Справочник MQL4
 
It would be something to enjoy. It's all very old.

Ilya Melamed

Read the articles, of course, but keep in mind, that the main function is different and it's better to build the beginning of indicators differently now (see the link I gave in the previous post). You can also look through the CodeBase indicators, writtenby Nikolay Kositsin. He ate them all:).

 

Greetings.

I am writing an EA in MT4 after void OnTick() from one function:

Print("TEXT");

(my task is to write "TEXT" in my log at every tick).

I compile it and it shows "TEXT" in the Tester's journal at every tick. When I enable the same Expert Advisor on the chart, the loading is successfully completed and that's it, the text "TEXT" is absent.

At the same time, functions Comment() and Alert() on the chart and in the tester work the same way.

What am I doing wrong?

 
spoiltboy:

Greetings.

I am writing an EA in MT4 after void OnTick() from one function:

Print("TEXT");

(my task is to write "TEXT" in my log at every tick).

I compile it and it shows "TEXT" in the Tester's journal at every tick. When I enable the same Expert Advisor on the chart, the loading is successfully completed and that's it, the text "TEXT" is absent.

At the same time, functions Comment() and Alert() on the chart and in the tester work the same way.

What am I doing wrong?

Please attach the complete code of the Expert Advisor and the name of the instrument, on which you run it.
 
Alexey Kozitsyn:
Please attach the complete code of the Expert Advisor and the name of the instrument on which you are running it.

Any instrument, USDCHF, H1 for example.

//+------------------------------------------------------------------+
//|                                                          123.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
  
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   Print("TEXT");
  }
//+------------------------------------------------------------------+

Автоматический трейдинг и тестирование торговых стратегий
Автоматический трейдинг и тестирование торговых стратегий
  • www.mql5.com
MQL5: язык торговых стратегий для MetaTrader 5, позволяет писать собственные торговые роботы, технические индикаторы, скрипты и библиотеки функций
 
spoiltboy:

Greetings.

I am writing an EA in MT4 after void OnTick() from one function:

Print("TEXT");

(my task is to write "TEXT" in my log at every tick).

I compile it and it shows "TEXT" in the Tester's journal at every tick. When I enable the same Expert Advisor on the chart, the loading is successfully completed and that's it, the text "TEXT" is absent.

At the same time, functions Comment() and Alert() work the same way on the chart and in the tester.

What am I doing wrong?

You are right. At that moment there were no ticks. To make it clearer, add a ticks counter and print its value.

int tik=0;
void OnTick()
{                                      
tik++;
Print("tik # = ", tik);
}
 
Vitalie Postolache:

It's true, it's just that there were no ticks at the time. To make it clearer, add a tick counter and print its value.

int tik=0;
void OnTick()
{                                      
tik++;
Print("tik # = ", tik);
}

TheComment() and Alert()functions work identically on the chart and in the tester.

What am I doing wrong?

 
spoiltboy:

Any instrument, USDCHF, H1 for example.

//+------------------------------------------------------------------+
//|                                                          123.mq4 |
//|                        Copyright 2016, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2016, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
  
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   Print("TEXT");

return(0);
  }
//+------------------------------------------------------------------+


Reason: