Artem Trishkin answered the same question to me, because it's a link (uppersand), so it can stand in any place. should try without spaces for the purity of the experiment.
Thank you, Valery! Will definitely consider this point if I ever run into a similar problem.
I continue studying the MQL5 programming language. I have modified the previously published code a bit and this is what I have got:
inputstring Symbol_Main="EURUSD"; //Валютная пара, на которую ставим советникinputENUM_TIMEFRAMES Time_Frame=PERIOD_H1; //Таймфрейм, на который ставим советник//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
/* Определим график валютной пары и таймфрейм, на который будем устанавливать советник. *//* Если текущий график валютной пары и текущий таймфрейм совпадают со входными параметрами */if(_Symbol==Symbol_Main && _Period==Time_Frame)
{
/* выводим окно сообщений на торговом терминале и продолжаем работу советника */MessageBox("Работа советника разрешена! Продолжим!");
return(INIT_SUCCEEDED); //возвращаем для функции OnInit значение означающее "удачная инициализация"
}
/* Если текущий график валютной пары и текущий таймфрейм не совпадают со входными параметрами */if(_Symbol!=Symbol_Main && _Period!=Time_Frame)
{
/* выводим окно сообщений на торговом терминале и закрываем советник */MessageBox("Не совпадают валютная пара и таймфрейм! Выходим!");
return(INIT_FAILED); //возвращаем для функции OnInit значение означающее "неудачная инициализация"
}
/* Если текущий график валютной пары не совпадает со входным параметром */if(_Symbol!=Symbol_Main)
{
/* выводим окно сообщений на торговом терминале и закрываем советник */MessageBox("Не совпадает валютная пара! Выходим!");
return(INIT_FAILED); //возвращаем для функции OnInit значение означающее "неудачная инициализация"
}
/* Если текущий таймфрейм не совпадает со входным параметром */if(_Period!=Time_Frame)
{
/* выводим окно сообщений на торговом терминале и закрываем советник */MessageBox("Не совпадет таймфрейм! Выходим!");
return(INIT_FAILED); //возвращаем для функции OnInit значение означающее "неудачная инициализация"
}
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
I have some free time and decided to continue my self-study. But all of a sudden I ran into a problem. Earlier, when I made a request like this to the trade server in my Expert Advisor Trailing_Stop_(v.2).mq5:
/* Создадим запрос на сервер и получим ответ с результатом */MqlTradeRequest request= {0};
MqlTradeResult result= {0};
there were no problems during code compilation. Now the compiler generates the following error:
I have some free time and decided to continue my self-study. But all of a sudden I ran into a problem. Earlier, when I made a request like this to the trade server in my Expert Advisor Trailing_Stop_(v.2).mq5:
there were no problems during code compilation. Now the compiler generates the following error:
I am continuing my self-study of MQL5 programming language. I decided to write a function for getting signal from ZigZag indicator. I started to study it thoroughly and it immediately raised some questions. I have it in its input parameters:
I am continuing my self-study of MQL5 programming language. I decided to write a function for getting signal from ZigZag indicator. I started to study it thoroughly and it immediately raised some questions. I have it in its input parameters:
I'm not fluent in English so I have to use Google Translator. What is the pure translation:
Questions:
If depth, depth of what?
If deviation, deviation from what, from what parameter or value?
If a step backwards, why a step backwards? Isn't it moving forward?
Dear experts, help me to understand!
Sincerely, Vladimir.
Elementary - search to help, " Doesn't it move forward " - the whole story moves backwards here!!!! :-)
Depth is the minimum number of bars on which there will not be a second high (low) less (more) by Deviation pips than the previous one, i.e. the ZigZag can always diverge, but converge (or shift the whole) more than by Deviation, the ZigZag can only after the Depth bars. The Backstep is the minimum number of bars between highs (lows).
Depth is the minimum number of bars on which there will be no second maximum (minimum) less (more) than the previous one by Deviation pips, i.e. the ZigZag can always diverge, but it can converge (or shift the whole) more than by Deviation, the ZigZag can only after Depth bars. The Backstep is the minimum number of bars between highs (lows).
While testing one Expert Advisor, I encountered a problem. It has the following code of EA initialization function:
//+------------------------------------------------------------------+//| Expert initialization function |//+------------------------------------------------------------------+intOnInit()
{
//--- достаточно ли количество баров для работыif(Bars(_Symbol,_Period)<60) // общее количество баров на графике меньше 60?
{
Alert("На графике меньше 60 баров, советник не будет работать!!");
return(-1);
}
//--- получить хэндл индикатора Bollinger Bands и DEMA
BolBandsHandle=iBands(NULL,PERIOD_M30,bands_period,bands_shift,deviation,PRICE_CLOSE);
demaHandle=iDEMA(NULL,PERIOD_D1,dema_period,0,PRICE_CLOSE);
//--- Нужно проверить, не были ли возвращены значения Invalid Handleif((BolBandsHandle<0) || (demaHandle<0))
{
Alert("Ошибка при создании индикаторов - номер ошибки: ",GetLastError(),"!!");
return(-1);
}
return(0);
}
2021.10.3113:19:25.752 Core 2 genetic pass (0, 288) tested with error "OnInit returned non-zero code -1"in0:00:00.0002021.10.3113:19:26.835 Core 2 genetic pass (0, 298) tested with error "OnInit returned non-zero code -1"in0:00:00.0002021.10.3113:19:26.921 Core 1 genetic pass (0, 42) tested with error "OnInit returned non-zero code -1"in0:00:00.0002021.10.3113:19:27.847 Core 2 genetic pass (0, 318) tested with error "OnInit returned non-zero code -1"in0:00:00.0002021.10.3113:19:27.848 Core 2 genetic pass (0, 326) tested with error "OnInit returned non-zero code -1"in0:00:00.0002021.10.3113:19:29.907 Core 2 genetic pass (0, 359) tested with error "OnInit returned non-zero code -1"in0:00:00.0002021.10.3113:19:29.907 Core 2 genetic pass (0, 371) tested with error "OnInit returned non-zero code -1"in0:00:00.0002021.10.3113:19:30.009 Core 1 genetic pass (0, 102) tested with error "OnInit returned non-zero code -1"in0:00:00.0002021.10.3113:19:30.009 Core 1 genetic pass (0, 105) tested with error "OnInit returned non-zero code -1"in0:00:00.0002021.10.3113:19:31.044 Core 1 genetic pass (0, 122) tested with error "OnInit returned non-zero code -1"in0:00:00.000
и т.д.
I found out that the problem is in checking the Bollinger Bands and DEMA indicators handles. I have already checked Bollinger Bands and DEMA indicators handles, so I have a question: What should I change in my code to correct these errors?
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.
Artem Trishkin answered the same question to me, because it's a link (uppersand), so it can stand in any place. should try without spaces for the purity of the experiment.
Thank you, Valery! Will definitely consider this point if I ever run into a similar problem.
Merry Christmas!
Sincerely, Vladimir.
Happy trading and good mood everyone!
I continue studying the MQL5 programming language. I have modified the previously published code a bit and this is what I have got:
Perhaps someone will need it.
Regards, Vladimir.
Good day and good mood everyone!
I have some free time and decided to continue my self-study. But all of a sudden I ran into a problem. Earlier, when I made a request like this to the trade server in my Expert Advisor Trailing_Stop_(v.2).mq5:
there were no problems during code compilation. Now the compiler generates the following error:
cannot convert 0 to enum'ENUM_TRADE_REQUEST_ACTIONS' Trailing_Stop_(v.2).mq5 411 30
If I remove a zero after request in curly brackets,
I don't get an error then. Please help me, what is the reason for this?
Regards, Vladimir.
Good day and good mood everyone!
I have some free time and decided to continue my self-study. But all of a sudden I ran into a problem. Earlier, when I made a request like this to the trade server in my Expert Advisor Trailing_Stop_(v.2).mq5:
there were no problems during code compilation. Now the compiler generates the following error:
cannot convert 0 to enum'ENUM_TRADE_REQUEST_ACTIONS' Trailing_Stop_(v.2).mq5 411 30
If I remove a zero after request in curly brackets,
I don't get an error then. Please help me, what is the reason for this?
Regards, Vladimir.
Yes, now do not write zero for zeroing.
ENUM_TRADE_REQUEST_ACTIONS , an enumeration that lacks the value "0".
The correct way would be:
MqlTradeRequest request={};Yes, now don't write zero for zeroing.
Thank you, Vladimir!
You live and learn a long time! If the MQL5 Reference developers would correct this everywhere, it would be great!
Sincerely, Vladimir.
Good morning everyone!
I am continuing my self-study of MQL5 programming language. I decided to write a function for getting signal from ZigZag indicator. I started to study it thoroughly and it immediately raised some questions. I have it in its input parameters:
I'm not fluent in English so I have to use Google Translator. What is the pure translation:
Depth - глубинаDeviation - отклонениеBackstep - шаг назадQuestions:
Dear experts, help me to understand!
Sincerely, Vladimir.
Good morning everyone!
I am continuing my self-study of MQL5 programming language. I decided to write a function for getting signal from ZigZag indicator. I started to study it thoroughly and it immediately raised some questions. I have it in its input parameters:
I'm not fluent in English so I have to use Google Translator. What is the pure translation:
Questions:
Dear experts, help me to understand!
Sincerely, Vladimir.
Elementary - search to help, " Doesn't it move forward " - the whole story moves backwards here!!!! :-)
https://www.mql5.com/ru/code/7796
Depth is the minimum number of bars on which there will not be a second high (low) less (more) by Deviation pips than the previous one, i.e. the ZigZag can always diverge, but converge (or shift the whole) more than by Deviation, the ZigZag can only after the Depth bars. The Backstep is the minimum number of bars between highs (lows).
In the search box, type in: e.g. zigzag parameters, https://www.mql5.com/ru/search#!keyword=%D0%B7%D0%B8%D0%B3%20%D0%B7%D0%B0%D0%B3%20%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D1%8B&page=2</b></p>
PS elementary things...
Elementary - search to help, " Isn't it moving forward " - the whole story is moving backwards here!!!! :-)
https://www.mql5.com/ru/code/7796
Depth is the minimum number of bars on which there will be no second maximum (minimum) less (more) than the previous one by Deviation pips, i.e. the ZigZag can always diverge, but it can converge (or shift the whole) more than by Deviation, the ZigZag can only after Depth bars. The Backstep is the minimum number of bars between highs (lows).
In the search box, type in: e.g. zigzag parameters, https://www.mql5.com/ru/search#!keyword=%D0%B7%D0%B8%D0%B3%20%D0%B7%D0%B0%D0%B3%20%D0%BF%D0%B0%D1%80%D0%B0%D0%BC%D0%B5%D1%82%D1%80%D1%8B&page=2</b></p>
PS elementary things...
Thank you very much, Roman! You gave the most concise, but at the same time, understandable explanation.
Respectfully, Vladimir.
Thank you very much, Roman! You have given the most concise, but at the same time understandable explanation.
Respectfully, Vladimir.
Good day everyone!
While testing one Expert Advisor, I encountered a problem. It has the following code of EA initialization function:
While testing the EA I get messages in the log:
I found out that the problem is in checking the Bollinger Bands and DEMA indicators handles. I have already checked Bollinger Bands and DEMA indicators handles, so I have a question: What should I change in my code to correct these errors?
Regards, Vladimir.