Restablecer las variables a la medianoche

 

Publi

Página 1 de 402 12 ÚltimoÚltimo
Resultados 1 al 10 de 11

Tema: Restablecer las variables a la medianoche

  1. #1
    ¿Cómo puedo restablecer var? Sugiero que, si no llegan tics al minuto, la var no se reiniciará.

    Sé que este no es el derecho a actuar, pero esta es la única forma en que mi cerebro puede pensar en este momento. Debe haber una manera mucho más fácil de hacer esto?

    Código insertado dual DayHigh = 0; dual Day2ndHigh = 0; DayLow dual = 0; dual Day2ndLow = 0; string time_hours = TimeHour (TimeCurrent ()); string time_minutes = TimeMinute (TimeCurrent ()); string time_seconds = TimeSeconds (TimeCurrent ()); if ((time_hours == 00) (time_minutes == 00) (time_seconds == 00))/Restablecer HighsLows dual DayHigh = 0; dual Day2ndHigh = 0; DayLow dual = 0; dual Day2ndLow = 0;
    ¿Está hecho sin depender de las garrapatas?

  2. #2

    Cita Iniciado por ;
    ¿Cómo puedo restablecer var a la medianoche? Quiero decir que si no hay tics en algún momento, la var no se reiniciará. Soy consciente de que este no es el derecho de actuar, pero esta es la única forma en que mi mente puede pensar en este momento. Debe haber un medio más fácil para hacer esto? Double DayHigh = 0; doble Day2ndHigh = 0; doble DayLow = 0; doble Day2ndLow = 0; string time_hours = TimeHour (TimeCurrent ()); string time_minutes = TimeMinute (TimeCurrent ()); string time_seconds = TimeSeconds (TimeCurrent ()); if ((time_hours == 00) (time_minutes == 00) (time_seconds == 00)) {...
    Sí, necesitarás usar la función OnTimer (). Además, querrás evitar absolutos; como cuando los segundos son iguales a cero, ya que puede pasar por alto la ventana donde el segundo es exactamente cero y su código no funcionaría. Código insertado int OnInit ()/- create timer EventSetTimer (1);/- return (INIT_SUCCEEDED);/ ----------------------------------------------- ------------------- /| Función de deinicialización experta |/ ----------------------------------------------- ------------------- void OnDeinit (const int reason)/- cronómetro de ruina EventKillTimer ();/ ----------------------------------------------- ------------------- /| Función de tick experto |/ ----------------------------------------------- ------------------- void OnTick ()/-/ ------------------- ----------------------------------------------- /| Función del temporizador |/ ----------------------------------------------- ------------------- void OnTimer ()/- ResetVarsAtMidnight ();/ ----------------------------------------------- ------------------- doble DayHigh = 0; doble Day2ndHigh = 0; doble DayLow = 0; doble Day2ndLow = 0; void ResetVarsAtMidnight () TimeCurrent () gt; = last_reset PeriodSeconds (PERIOD_D1))/Restablecer altasbajas DayHigh = 0; Day2ndHigh = 0; DayLow = 0; Day2ndLow = 0; TimeCurrent (last_reset_struct); last_reset_struct. Hora last_reset_struct. Min = 0; last_reset_struct. sec = 0; last_reset = StructToTime (last_reset_struct); regreso;

  3. #3

    Cita Iniciado por ;
    quote Sí, tendrá que usar la función OnTimer (). Además, querrás evitar absolutos; como si los segundos son iguales a cero, ya que es posible que pierda la ventana en la que el segundo es exactamente cero y luego su código no funcionaría. Int OnInit ()/- crea el temporizador EventSetTimer (1);/- return (INIT_SUCCEEDED);/ ----------------------------------------------- ------------------- /| Función de deinicialización experta |/ ----------------------------------------------- ------------------- vacío OnDeinit (const int reason) {//- destruye el temporizador ...
    Gracias por su ejemplo de código! No debería poder probarlo colóquelo last_reset_struct. Hora 20; last_reset_struct. Min = 40; last_reset_struct. Sec = 00; Si es así, no coloca los vars en 0.

  4. #4
    Eso debería reiniciar 20:40

  5. #5

    Cita Iniciado por ;
    Eso debería reiniciar todos los días a las 20:40
    Sí, sin embargo, no restablece las var

  6. #6

    Cita Iniciado por ;
    citar Sí, pero no restablece las var
    ya que no se restablece hasta el día siguiente después de la inicialización. Si desea que pueda hacerlo, lo necesita, entonces necesita agregar alguna lógica de inicialización e inicializarla en el momento anterior. Código insertado int OnInit ()/- create timer EventSetTimer (1);/- return (INIT_SUCCEEDED);/ ----------------------------------------------- ------------------- /| Función de deinicialización experta |/ ----------------------------------------------- ------------------- void OnDeinit (const int reason)/- cronómetro de ruina EventKillTimer ();/ ----------------------------------------------- ------------------- /| Función de tick experto |/ ----------------------------------------------- ------------------- void OnTick ()/-/ ------------------- ----------------------------------------------- /| Temporizador operar |/ ----------------------------------------------- ------------------- void OnTimer ()/- ResetVarsAtMidnight ();/ ----------------------------------------------- ------------------- dual DayHigh = 0; dual Day2ndHigh = 0; DayLow dual = 0; dual Day2ndLow = 0; void ResetVarsAtMidnight () MqlDateTime last_reset_struct; static datetime last_reset = TimeCurrent (); static bool is_init = false; int hora = 0; int min = 0; int sec = 0; if (! is_init) last_reset- = PeriodSeconds (PERIOD_D1); TimeToStruct (last_reset, last_reset_struct); last_reset_struct. Hora last_reset_struct. Min = min; last_reset_struct. sec = sec; last_reset = StructToTime (last_reset_struct); is_init = verdadero; if (TimeCurrent () gt; = last_reset PeriodSeconds (PERIOD_D1))/Restablecer altasbajas DayHigh = 0; Day2ndHigh = 0; DayLow = 0; Day2ndLow = 0; TimeCurrent (last_reset_struct); last_reset_struct. Hora last_reset_struct. Min = min; last_reset_struct. sec = sec; last_reset = StructToTime (last_reset_struct); regreso;

  7. #7

    Cita Iniciado por ;
    quote Dado que no se restablece hasta el día siguiente después de la inicialización. Si desea hacerlo para que lo necesite, deberá agregar alguna lógica de inicialización e inicializarlo el día anterior. Int OnInit ()/- make timer EventSetTimer (1);///- return (INIT_SUCCEEDED);/pag----------------------------------------------- ------------------- /| Función de deinicialización experta |/pag----------------------------------------------- ------------------- vacío OnDeinit (const int reason) {//- ruin timer EventKillTimer (); ...
    Estoy intentando esto para ver si funciona, pero no puedo entender que var se establezca en cero en, por ej. 21:10:00, ¿por qué? Código insertado/ --------------------------------------------- --------------------- /| Test.mq4 |/| Copyright 2017, MetaQuotes Software Corp .. |/| https://www.mql5.com |/pag----------------------------------------------- ------------------- #property copyright Copyright 2017, MetaQuotes Software Corp. enlace #property https://www.mql5.com #property version 1.00 #property strict int OnInit ()/- make timer EventSetTimer (1);/- return (INIT_SUCCEEDED);/ ----------------------------------------------- ------------------- /| Función de deinicialización experta |/ ----------------------------------------------- ------------------- vacío OnDeinit (const int reason)/- cronómetro de ruina EventKillTimer ();/ ----------------------------------------------- ------------------- /| Función de tick experto |/ ----------------------------------------------- ------------------- void OnTick () DayHigh = High # 91; 1 # 93 ;; Day2ndHigh = High # 91; 293 ;; DayLow = Reducido # 91; 1 # 93 ;; Day2ndLow = Reduced # 91; 2 # 93 ;; Comentario (High_1: DayHigh High_2: Day2ndHigh Low_1: DayLow Low_2: Day2ndLow);/ ----------------------------------------------- ------------------- /| Función del temporizador |/ ----------------------------------------------- ------------------- void OnTimer ()/- ResetVarsAtMidnight ();/ ----------------------------------------------- ------------------- doble DayHigh = 0; doble Day2ndHigh = 0; doble DayLow = 0; doble Day2ndLow = 0; vacío ResetVarsAtMidnight () MqlDateTime last_reset_struct; static datetime last_reset = TimeCurrent (); static bool is_init = false; int hora = 21; int min = 10; int sec = 0; if (! is_init) last_reset- = PeriodSeconds (PERIOD_D1); TimeToStruct (last_reset, last_reset_struct); last_reset_struct. Hora = hora; last_reset_struct. Min = min; last_reset_struct. sec = sec; last_reset = StructToTime (last_reset_struct); is_init = verdadero; if (TimeCurrent () gt; = last_reset PeriodSeconds (PERIOD_D1))/Restablecer altasbajas DayHigh = 0; Day2ndHigh = 0; DayLow = 0; Day2ndLow = 0; TimeCurrent (last_reset_struct); last_reset_struct. Hora = hora; last_reset_struct. Min = min; last_reset_struct. sec = sec; last_reset = StructToTime (last_reset_struct); regreso;

  8. #8

    Cita Iniciado por ;
    Citar Estoy tratando de ver si funciona, pero no puedo ver que la var se ponga a cero en, por ejemplo, 21:10:00, ¿por qué?/ ----------------------------------------------- ------------------- /| Test.mq4 |/| Copyright 2017, MetaQuotes Software Corp .. |/|
    https://www.mql5.com|/ ----------------------------------------------- ------------------- #property copyright Copyright 2017, MetaQuotes Software Corp. #property link https://www.mql5.com #property variant 1.00 #property stringent int OnInit () {//- make timer EventSetTimer (1);/- return (INIT_SUCCEEDED); ...
    Funciona. Tu código no te va a mostrar. Prueba esto. Código insertado/ --------------------------------------------- --------------------- /| DailyVarReset.mq4 |/| Copyright 2017, nicholishen |/| https://www.forexycfds.com/nicholishen |/ ----------------------------------------------- ------------------- #property copyright Copyright 2017, nicholishen #property link https://www.forexycfds.com/nicholishen/ ------ -------------------------------------------------- ---------- /| Test.mq4 |/| Copyright 2017, MetaQuotes Software Corp .. |/| https://www.mql5.com |/ ----------------------------------------------- ------------------- #property copyright Copyright 2017, MetaQuotes Software Corp. #property link https://www.mql5.com #property variant 1.00 #property stringent int OnInit ()/- make timer EventSetTimer (1);/- return (INIT_SUCCEEDED);/ ----------------------------------------------- ------------------- /| Función de deinicialización experta |/ ----------------------------------------------- ------------------- void OnDeinit (const int reason)/- cronómetro de ruina EventKillTimer ();/ ----------------------------------------------- ------------------- /| Función de tick experto |/ ----------------------------------------------- ------------------- void OnTick ()/DayHigh = High # 91; 1 # 93 ;;/Day2ndHigh = High # 91; two # 93 ;;/DayLow = Low # 91; 1 # 93 ;;/Day2ndLow = Low # 91; two # 93 ;;/Opinión (High_1: DayHigh High_2: Day2ndHigh Low_1: DayLow Low_2: Day2ndLow);/ ----------------------------------------------- ------------------- /| Función del temporizador |/ ----------------------------------------------- ------------------- void OnTimer ()/- ResetVarsAtMidnight ();/ ----------------------------------------------- ------------------- dual DayHigh = 0; dual Day2ndHigh = 0; DayLow dual = 0; dual Day2ndLow = 0; void ResetVarsAtMidnight () MqlDateTime last_reset_struct; static datetime last_reset = TimeCurrent (); static bool is_init = false; int hora = 18; int min = 56; int sec = 0; if (! is_init) last_reset- = PeriodSeconds (PERIOD_D1); TimeToStruct (last_reset, last_reset_struct); last_reset_struct. Hora; last_reset_struct. Min = min; last_reset_struct. sec = sec; last_reset = StructToTime (last_reset_struct); is_init = verdadero; if (TimeCurrent () gt; = last_reset PeriodSeconds (PERIOD_D1))/Restablecer altasbajas DayHigh = 0; Day2ndHigh = 0; DayLow = 0; Day2ndLow = 0; Alert (Resting vars!);**********TimeCurrent (last_reset_struct); last_reset_struct. Hora; last_reset_struct. Min = min; last_reset_struct. sec = sec; last_reset = StructToTime (last_reset_struct); regreso;

  9. #9

    Cita Iniciado por ;
    Cita Funciona. Tu código nunca te lo mostrará. Prueba esto./ ----------------------------------------------- ------------------- /| DailyVarReset.mq4 |/| Twist 2017, nicholishen |/|
    https://www.forexycfds.com/forex-mar...e-journal.html|/ ----------------------------------------------- ------------------- #property copyright Copyright 2017, nicholishen #property hyperlink https://www.forexycfds.com/nicholishen/ ------ -------------------------------------------------- ---------- /| Test.mq4 |/| Copyright 2017, MetaQuotes Software Corp ....
    Funciona muy bien ¡Gracias al código y a tu ayuda! Solo tengo curiosidad, ¿estás disponible para contratar si necesito un codificador fantástico?

  10. #10

    Cita Iniciado por ;
    citar Sí
    Estupendo

Permisos de publicación

  • No puedes crear nuevos temas
  • No puedes responder temas
  • No puedes subir archivos adjuntos
  • No puedes editar tus mensajes
  •  
Cookies
Utilizamos cookies propias y de terceros para mejorar nuestros servicios y mostrarle publicidad relacionada con sus preferencias mediante el análisis de sus hábitos de navegación. Si continua navegando, consideramos que acepta su uso. Puede cambiar la configuración u obtener más información y política de cookies aquí.