Questions from Beginners MQL5 MT5 MetaTrader 5 - page 16

 
Karlson:

(Please file this down but please))) I really thought I could not do it, but something came up. Again, I do not pretend to be right. This is not my bread )))

If something is not clear, then specify. I do not know how to count zigzag that recalculated, so marks have a chance to disappear, as well as appear redundant. on peaks, but there zigzag no longer.

Thanks :) I'll try to figure it out.

Neither do I know :) the scheme is simple: I copy from the handle a zigzag color and 2 bafer files with ready values of extrema, highs and lows, and a separate array with bars open time. I work with these arrays. (In a single-type zigzag, there is one buffer where Hai and Lowe's are laid out one by one).

It turns out,there is a zigzag that builds a couple of fibowers.

Off to dig :)

 
Please advise: the strategy determines the entry point, TP and SL. The next signal may appear before the close of previous order. If robot opens a new one in MT5, it will lead to shit - SL and TP of unfinished trade will be overwritten, and total lot will not correspond to new SL and TP of neither of two trades.

Maybe I should use pendants instead of SL/TP - may I share the source code of the solution? Or maybe there are other variants?
 

Hello, I can't find any information on the forum please help. I have to make a function that returns indicator value.

For example, in mql4 you could do it like this:

double Fast_MA(int Sdvig)
{
return(iMA(NULL, TF, FastMA, 0, MODE_SMA, PRICE_CLOSE, Sdvig))
}

and then in signal processing use simply

if ( Fast_MA(1) > Fast_MA(2), etc.)

How to do it correctly in mql5, please share with me, if you don't mind. Thank you.

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы индикаторов / Ценовые константы - Документация по MQL5
 
BALDEYU_OT_MT5:

Hello, I can't find any information on the forum please help. I have to make a function that returns indicator value.

For example, in mql4 you could do it like this:

double Fast_MA(int Sdvig)
{
return(iMA(NULL, TF, FastMA, 0, MODE_SMA, PRICE_CLOSE, Sdvig))
}

and then in signal processing use simply

if ( Fast_MA(1) > Fast_MA(2) etc)

How to do it correctly in mql5, please share with me, if you don't mind. Thank you.

You need to call the indicator through iMA or another function of those indicators. The functions return the handles that you have to remember.

This is usually done at OnInit, because even after removal of the indicator it stays in running processes for some time (5-15 min).

And then using CopyBuffer(handle,...) you obtain the necessary values for indicator.

Technical indicators

Access to timeseries and indicators

The examples in documentation are overloaded to show all possible ways. In simple words, it looks like this:

// тут получаем хендл индюка, объявления переменных я опустил чтоб не нагромождать
handle=iMA(symbol,period,ma_period,ma_shift,ma_method,applied_price);
// тут получаем нужные данные
CopyBuffer(handle,0,1,to_copy,MABuffer);
// данные индикатора из буффера 0, будут скопированы в MABuffer[], от первого значения, в количестве to_copy

Almost read the documentation, the functions have overloads.

 
Urain:

To do this, you first need to call the indicator via iMA or other functions of those indicators. The functions return the handles that you need to memorize.

This is usually done at OnInit, because even after removing an indicator it stays in running processes for a while (5-15 min).

And then using the CopyBuffer(handle,...) you get the necessary values of the indicator.

Technical indicators

Access to timeseries and indicators

The examples in documentation are overloaded to show all possible ways. In simple words, it looks like this:

Read the documentation, functions have overloads.

What do you mean functions have overloads? Seems easier to do as written in the documentation, nothing you can get used to.
 
BALDEYU_OT_MT5:
What do you mean "functions have overloads"? Seems easier to do as written in documentation, nothing you can get used to.

This means that under one name there are several functions with different parameters and correspondingly (although similar) but different actions.

In the case of CopyBuffer it is:

The calls differ only in the way the data is searched by index or by date.

Обращение по начальной позиции и количеству требуемых элементов

int  CopyBuffer(
   int       indicator_handle,     // handle индикатора
   int       buffer_num,           // номер буфера индикатора
   int       start_pos,            // откуда начнем 
   int       count,                // сколько копируем
   double    buffer[]              // массив, куда будут скопированы данные
   );

Обращение по начальной дате и количеству требуемых элементов

int  CopyBuffer(
   int       indicator_handle,     // handle индикатора
   int       buffer_num,           // номер буфера индикатора
   datetime  start_time,           // с какой даты
   int       count,                // сколько копируем
   double    buffer[]              // массив, куда будут скопированы данные
   );

Обращение по начальной и конечной датам требуемого интервала времени

int  CopyBuffer(
   int       indicator_handle,     // handle индикатора
   int       buffer_num,           // номер буфера индикатора
   datetime  start_time,           // с какой даты
   datetime  stop_time,            // по какую дату
   double    buffer[]              // массив, куда будут скопированы данные
   );
 

Colleagues, can you tell me who knows? I want to make a spread chart between two currency pairs. I made it as an indicator in a separate window, but how do I create a new empty chart window, where there will be no currency quotes and only my spread? is it even possible ?

Thank you for your attention.

 

Hello.

Please advise how to do this correctly? I have a simple Expert Advisor. It consists of two files with executable and include one with class. It compiles and runs. I want to put everything in one executable file. How to properly copy and place the include file in the main one? Before OnInit() or after OnTick()? I understand that it's no problem to make and check this or that, but I don't want to finally get a bug and my head will explode with "what's wrong with this". I am interested in how to do it correctly according to language standards, so that I won't have to look for errors in file architecture. I just don't know how to do it correctly.

Thank you in advance.

Документация по MQL5: Основы языка / Функции / Функции обработки событий
Документация по MQL5: Основы языка / Функции / Функции обработки событий
  • www.mql5.com
Основы языка / Функции / Функции обработки событий - Документация по MQL5
 
RedFish:

Hello.

Please advise how to do this correctly? I have a simple Expert Advisor. It consists of two files with executable and include one with class. It compiles and runs. I want to put everything in one executable file. How to properly copy and place the include file in the main one? Before OnInit() or after OnTick()? I understand that it's no problem to make and check this or that, but I don't want to finally get a bug and my head will explode with "what's wrong with this". I am interested in how to do it correctly according to language standards, so that I won't have to look for errors in file architecture. I just don't know how to do it correctly.

Thank you in advance.

Copy the inline and paste it in place of the directive in mq5 file.
 
Urain:
Copy the inline and paste in place of the directive in the mq5 file.
Got it. Thank you.