Testing_Scripts/EA_test_timer_event.mq5
super.admin 48c5f07b6e convert
2025-05-30 16:30:20 +02:00

64 lines
2.1 KiB
MQL5

//+------------------------------------------------------------------+
//| EA_test_timer_event.mq5 |
//| Copyright 2019, MetaQuotes Software Corp. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2019, MetaQuotes Software Corp."
#property link "https://www.mql5.com"
#property version "1.00"
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
#include "My_EA.mqh"
//Global objects of program
CMy_EA myea;
int OnInit()
{
//--- create timer
//EndTime= TimeCurrent()-
EventSetTimer(5);
myea.SetDaysOffset(2);
myea.OnStartM();
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//--- destroy timer
EventKillTimer();
printf("timer killed");
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
}
//+------------------------------------------------------------------+
//| Timer function |
//+------------------------------------------------------------------+
void OnTimer()
{
//---
printf("5 seconds");
datetime d2=D'01.07.2019 22:37:27';
int newtimer = d2 - TimeGMT();
EventKillTimer();
EventSetTimer(newtimer);
printf("10 seconds");
printf(TimeCurrent());
printf(TimeLocal());
printf(TimeTradeServer());
printf(TimeGMT());
}
//+------------------------------------------------------------------+