//+------------------------------------------------------------------+
//| Test_DST 2.mq5 |
//| Calli |
//| https://www.mql5.com/de/users/gooly |
//+------------------------------------------------------------------+
#property copyright "Calli"
#property link "https://www.mql5.com/de/users/gooly"
#property version "1.00"
#include <DealingWithTime.mqh>
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//---
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---
}
//+------------------------------------------------------------------+
//| Expert tick function |
//+------------------------------------------------------------------+
void OnTick()
{
//---
int y,m,d; // year, month, day
datetime t; // date to request DSTs
y = 1975;
while(y++<2030) {
// check spring times
m = int(GetMicrosecondCount()%6 + 1); // random month 1-6
d = int(GetMicrosecondCount()%26 + 1); // random day 1 - 27
t = StringToTime(string(y)+"."+(string)m+"."+(string)d+" 01:00");
calcSwitchUSD(t); // calc DST USA
if (DoWi(nxtSwitch_USD) > 0) // check for Sunday
DebugBreak();
calcSwitchEUR(t); // calc DST Europe
if (DoWi(nxtSwitch_EUR) > 0) // check for Sunday
DebugBreak();
calcSwitchAUD(t); // calc DST AUD (Sydney)
if (DoWi(nxtSwitch_AUD) > 0) // check for Sunday
DebugBreak();
// check autumn times
t = StringToTime(string(y)+"."+(string)(m+6)+"."+(string)d+" 01:00");
calcSwitchUSD(t); // calc DST USA
if (DoWi(nxtSwitch_USD) > 0) // check for Sunday
DebugBreak();
calcSwitchEUR(t); // calc DST Europe
if (DoWi(nxtSwitch_EUR) > 0) // check for Sunday
DebugBreak();
calcSwitchAUD(t); // calc DST AUD (Sydney)
if (DoWi(nxtSwitch_AUD) > 0) // check for Sunday
DebugBreak();
}
ExpertRemove();
}
//+------------------------------------------------------------------+
Comments