Tried your code. You got me wrong or you got it wrong! This code gives me a message every tick of formation of a new bar at any timeframe, and I need for example on M5 to give out after 5 minutes, as soon as it is completely formed every 1st bar. How to do it? Try this code yourself as an EA:
int start() // Спец. функция start { int New_Time; Fun_New_Bar(); // Польз. ф-ия обнаружения нового бара Alert("Сформировался новый бар"); // Вывод на экран return; // Выход из start() } //-------------------------------------------------------------------- bool Fun_New_Bar() // Ф-ия обнаружения нового бара { static datetime New_Time=0; // Время текущего бара bool New_Bar=false; // Нового бара нет if(New_Time!=Time[0]) // Сравниваем время { New_Time=Time[0]; // Теперь время такое New_Bar=true; // Поймался новый бар } }
I tried your code. You got me wrong or you got it wrong! This code gives me a message every tick of formation of a new bar at any timeframe, and I need for example on M5, to give out after 5 minutes, as soon as fully formed every 1-st bar. How to do it? Try this code yourself as an EA:
int start() // Спец. функция start { int New_Time; Fun_New_Bar(); // Польз. ф-ия обнаружения нового бара Alert("Сформировался новый бар"); // Вывод на экран return; // Выход из start() } //-------------------------------------------------------------------- bool Fun_New_Bar() // Ф-ия обнаружения нового бара { static datetime New_Time=0; // Время текущего бара bool New_Bar=false; // Нового бара нет if(New_Time!=Time[0]) // Сравниваем время { New_Time=Time[0]; // Теперь время такое New_Bar=true; // Поймался новый бар } }
I didn't give you one, look carefully - I gave you another one:
if(Fun_New_Bar())//проверка наличия нового бара
{
//а здесь разместить весь код эксперта
}
Compare what you wrote inside the start() function and what I suggested to you. Are they the same thing?
Write it out properly, because I don't understand it!
Take all subroutines out of the body of the start function - you cannot declare other functions within one function. You can call them. You cannot declare and describe them.
Remove all subprograms from the body of the start function - you cannot declare other subprograms inside one function. You can call them. Declare and describe - not allowed.
Right:
int start() // Спец. функция start { if(Fun_New_Bar())//проверка наличия нового бара { Alert("Сформировался новый бар"); // Вывод на экран return; // Выход из start() } } //-------------------------------------------------------------------- bool Fun_New_Bar() // Ф-ия обнаружения .. { // .. нового бара static datetime New_Time=0; // Время текущего бара bool New_Bar=false; // Нового бара нет if(New_Time!=Time[0]) // Сравниваем время { New_Time=Time[0]; // Теперь время такое New_Bar=true; // Поймался новый бар } }
int start() // Спец. функция start { if(Fun_New_Bar())//проверка наличия нового бара { Alert("Сформировался новый бар"); // Вывод на экран return(0); // Выход из start() } } //-------------------------------------------------------------------- bool Fun_New_Bar() // Ф-ия обнаружения .. { // .. нового бара static datetime New_Time=0; // Время текущего бара bool New_Bar=false; // Нового бара нет if(New_Time!=Time[0]) // Сравниваем время { New_Time=Time[0]; // Теперь время такое New_Bar=true; // Поймался новый бар } }
It would be more accurate to put it this way:
int start() // Спец. функция start
{
if(Fun_New_Bar())//проверка наличия нового бара
{
Alert("Сформировался новый бар"); // Вывод на экран
}
return(0); // Выход из start()
}
//--------------------------------------------------------------------bool Fun_New_Bar() // Ф-ия обнаружения ..
{ // .. нового бараstatic datetime New_Time=0; // Время текущего бараbool New_Bar=false; // Нового бара нетif(New_Time!=Time[0]) // Сравниваем время
{
New_Time=Time[0]; // Теперь время такое
New_Bar=true; // Поймался новый бар
}
}
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.
Tk write a ready-made one, because I'm just a beginner...
What is the log?
Shit, the file isn't yours - got it from a tutorial. Is it hard to attach it to your post? Just do it with the source code.
Tried your code. You got me wrong or you got it wrong! This code gives me a message every tick of formation of a new bar at any timeframe, and I need for example on M5 to give out after 5 minutes, as soon as it is completely formed every 1st bar. How to do it? Try this code yourself as an EA:
int start() // Спец. функция start
{
int New_Time;
Fun_New_Bar(); // Польз. ф-ия обнаружения нового бара
Alert("Сформировался новый бар"); // Вывод на экран
return; // Выход из start()
}
//--------------------------------------------------------------------
bool Fun_New_Bar() // Ф-ия обнаружения нового бара
{
static datetime New_Time=0; // Время текущего бара
bool New_Bar=false; // Нового бара нет
if(New_Time!=Time[0]) // Сравниваем время
{
New_Time=Time[0]; // Теперь время такое
New_Bar=true; // Поймался новый бар
}
}
I HAVE A PROBLEM ....
When I set up mail in the terminal - I use smtp.gmail.com:25
I get the error - Mail: 530 5.7.0 Must issue a STARTTLS command first. l3sm2329679fan.0
I tried your code. You got me wrong or you got it wrong! This code gives me a message every tick of formation of a new bar at any timeframe, and I need for example on M5, to give out after 5 minutes, as soon as fully formed every 1-st bar. How to do it? Try this code yourself as an EA:
int start() // Спец. функция start
{
int New_Time;
Fun_New_Bar(); // Польз. ф-ия обнаружения нового бара
Alert("Сформировался новый бар"); // Вывод на экран
return; // Выход из start()
}
//--------------------------------------------------------------------
bool Fun_New_Bar() // Ф-ия обнаружения нового бара
{
static datetime New_Time=0; // Время текущего бара
bool New_Bar=false; // Нового бара нет
if(New_Time!=Time[0]) // Сравниваем время
{
New_Time=Time[0]; // Теперь время такое
New_Bar=true; // Поймался новый бар
}
}
I didn't give you one, look carefully - I gave you another one:
Compare what you wrote inside the start() function and what I suggested to you. Are they the same thing?I didn't give you one, look carefully - I gave you another one:
Compare what you wrote inside the start() function and what I gave you. Are they the same thing?You should write it properly, because I don't understand it!
Write it out properly, because I don't understand it!
Take all subroutines out of the body of the start function - you cannot declare other functions within one function. You can call them. You cannot declare and describe them.
Remove all subprograms from the body of the start function - you cannot declare other subprograms inside one function. You can call them. Declare and describe - not allowed.
Right:
int start() // Спец. функция start
{
if(Fun_New_Bar())//проверка наличия нового бара
{
Alert("Сформировался новый бар"); // Вывод на экран
return; // Выход из start()
}
}
//--------------------------------------------------------------------
bool Fun_New_Bar() // Ф-ия обнаружения ..
{ // .. нового бара
static datetime New_Time=0; // Время текущего бара
bool New_Bar=false; // Нового бара нет
if(New_Time!=Time[0]) // Сравниваем время
{
New_Time=Time[0]; // Теперь время такое
New_Bar=true; // Поймался новый бар
}
}
So:
int start() // Спец. функция start
{
if(Fun_New_Bar())//проверка наличия нового бара
{
Alert("Сформировался новый бар"); // Вывод на экран
return(0); // Выход из start()
}
}
//--------------------------------------------------------------------
bool Fun_New_Bar() // Ф-ия обнаружения ..
{ // .. нового бара
static datetime New_Time=0; // Время текущего бара
bool New_Bar=false; // Нового бара нет
if(New_Time!=Time[0]) // Сравниваем время
{
New_Time=Time[0]; // Теперь время такое
New_Bar=true; // Поймался новый бар
}
}
It would be more accurate to put it this way:
It would be more accurate to put it this way:
I try it on M1 and after the next bar is formed the message doesn't come out. So what, it's not working?