Cualquier pregunta de los recién llegados sobre MQL4 y MQL5, ayuda y discusión sobre algoritmos y códigos - página 473

 
Bek001:

Lo diré de otra manera. ¿Cómo se puede determinar el precio máximo en los últimos 10 segundos?

En MT5 - CopyTicks()

En MT4 - guardar los ticks en un array de estructuras MqlTick. A partir de ella, toma los precios máximos y mínimos.

 

¿Puede decirme cómo hacerlo? Escribí una función de notificación y las notificaciones aparecen cada vez que se hace un clic. La función en sí misma sólo está escrita en int Start. Condiciones del patrón en la M30.

///--------------------------------------------------------------------------------------------
/// ФУНКЦИЯ ОТПРАВКИ УВЕДОМЛЕНИЙ
///--------------------------------------------------------------------------------------------
void NOTIFICATION()
{

int DayT=0,BarTime;
 if(DayT!=Day())// Если новый день - нужно опросить
 {
 DayT=Day();
if(Push_On&&DAY_HIGH())SendNotification("ДЕНЬ ЗАКРЫЛСЯ ВЫШЕ ЛИНИИ -" + Symbol());
if(Push_On&&DAY_LOW())SendNotification("ДЕНЬ ЗАКРЫЛСЯ НИЖЕ ЛИНИИ -" + Symbol());
}
if (BarTime==Time[0]) // Если новый бар - нужно опросить
{
   BarTime=Time[0];
if(Push_On&&DAY_HIGH()&&PATERN_BUY())SendNotification("ДЕНЬ ЗАКРЫЛСЯ ВЫШЕ ЛИНИИ + ПАТТЕРН -" + Symbol());
if(Push_On&&DAY_LOW()&&PATERN_SELL())SendNotification("ДЕНЬ ЗАКРЫЛСЯ НИЖЕ ЛИНИИ + ПАТТЕРН -" + Symbol());
}
}
 
Rewerpool:

¿Puede decirme cómo hacerlo? Escribí una función de notificación y las notificaciones aparecen cada vez que se hace un clic. La función en sí misma se escribe simplemente en int Start.

static int DíaT=0;
 
@Artyom Trishkin ¡Gracias! ¡Interesante salió ahora está tranquilo en absoluto!
 
Rewerpool:
@Artyom Trishkin ¡Gracias! ¡Interesante salió ahora está tranquilo en absoluto!
Es difícil leer el código desde un móvil. Probablemente haya algo más que no funciona.
 
Rewerpool:

¿Puede decirme cómo hacerlo? Escribí una función de notificación y las notificaciones aparecen cada vez que se hace un clic. La función en sí misma sólo está escrita en int Start. Condiciones del patrón en la M30.

int DayT=0;
datetime BarTime=TimeCurrent();
void NOTIFICATION()
{
   if(DayT!=Day())// Если новый день - нужно опросить
   {
      DayT=Day();
      if(Push_On&&DAY_HIGH())SendNotification("ДЕНЬ ЗАКРЫЛСЯ ВЫШЕ ЛИНИИ -" + Symbol());
      if(Push_On&&DAY_LOW())SendNotification("ДЕНЬ ЗАКРЫЛСЯ НИЖЕ ЛИНИИ -" + Symbol());
   }
   if (BarTime==Time[0]) // Если новый бар - нужно опросить
   {
      BarTime=Time[0];
      if(Push_On&&DAY_HIGH()&&PATERN_BUY())SendNotification("ДЕНЬ ЗАКРЫЛСЯ ВЫШЕ ЛИНИИ + ПАТТЕРН -" + Symbol());
      if(Push_On&&DAY_LOW()&&PATERN_SELL())SendNotification("ДЕНЬ ЗАКРЫЛСЯ НИЖЕ ЛИНИИ + ПАТТЕРН -" + Symbol());
   }
}

Se declaran variables y se compara inmediatamente con ellas. Por supuesto, siempre se obtiene el mismo resultado.

 
Artyom Trishkin:
Es difícil leer el código en un móvil. Debe haber algún otro problema.

Creo que debería haber sido así

datetime BarTime;
 

@Konstantin Nikitin ¡Hola!! ¡¡¡Lo he arreglado!!! ¡Las señales diarias han subido! ¡Todavía tengo que comprobar los intradía!

Arreglado. Aquí:

///--------------------------------------------------------------------------------------------
/// ФУНКЦИЯ ОТПРАВКИ УВЕДОМЛЕНИЙ
///--------------------------------------------------------------------------------------------
void NOTIFICATION()
{

static int DayT=0;
datetime BarTime;
 if(DayT!=Day())// Если новый день - нужно опросить
 {
 DayT=Day();
if(Push_On&&DAY_HIGH())SendNotification("ДЕНЬ ЗАКРЫЛСЯ ВЫШЕ ЛИНИИ -" + Symbol());
if(Push_On&&DAY_LOW())SendNotification("ДЕНЬ ЗАКРЫЛСЯ НИЖЕ ЛИНИИ -" + Symbol());
}
if (BarTime==Time[0]) // Если новый бар - нужно опросить
{
   BarTime=Time[0];
if(Push_On&&DAY_HIGH()&&PATERN_BUY())SendNotification("ДЕНЬ ЗАКРЫЛСЯ ВЫШЕ ЛИНИИ + ПАТТЕРН -" + Symbol());
if(Push_On&&DAY_LOW()&&PATERN_SELL())SendNotification("ДЕНЬ ЗАКРЫЛСЯ НИЖЕ ЛИНИИ + ПАТТЕРН -" + Symbol());
}
}
 
Rewerpool:

@Konstantin Nikitin ¡Hola!! ¡¡Corregido!! ¡Las señales diarias han subido! ¡Todavía tengo que comprobar los intradía!

Arreglado. Aquí:

static int DayT=0;
datetime BarTime;

Llévalo a nivel global. Siempre serán iguales a 0, porque cada vez que se llame a la función, se declarará una nueva.

 
@Konstantin Nikitin ¿Sugieres llevar estos parámetros fuera del cuerpo de la función? ¿O dejarlos como he escrito en la última captura de pantalla?
Razón de la queja: