Clock - Library for MetaTrader 4 | MT4 EA Download - MetaTrader 4 Resources
blank Cclock( blank ); void Cclock( integer offset, integer method); void put( const datetimevalue ); datetime datetime( integer offset, integer method); datetime servertime( blank ){ return (srvdt);} DateTime GMT( blank ) { return (GMT);} boolean is daylight saving time ( blank ); boolean is daylight saving time ( integer method); boolean is daylight saving time ( datetime value, integer method);
#Property Copyright "Copyright 2021, MetaQuotes Software Corp." #Property association "https://www.mql5.com" # Property version "1.00" #Property strict // from clock.mqh #define DAYLIGHTSAVING_METHOD_NONE 0 #define DAYLIGHTSAVING_METHOD_US 1 #define DAYLIGHTSAVING_METHOD_UK 2 #includes <clock.mqh> //+----------------------------------------------------------------------------------+ //|Global variables | //+------------------------------------------------------------------+ Cclock clock; //+------------------------------------------------------------------+ //|Expert initialization function | //+------------------------------------------------------------------+ Integer initialization () { //--- clock.GMT offset = 2 ; Clock.DSTMethod = DAYLIGHTSAVING_METHOD_US; //--- return ( initialization successful ); } //+------------------------------------------------------------------+ //|Expert to initialize function | //+------------------------------------------------------------------+ Blank solution initialization ( constant integer reason) { //--- } //+----------------------------------------------------------------------------------+ //|Expert check function | //+------------------------------------------------------------------+ Blank check () { //--- clock.set( timecurrent ()); // Set clock Clock.IsDaylightSavingTime(); // Returns true if the clock time complies with daylight saving time Clock.ServerTime(); // Returns the server time and date time Clock.GreenwichMeanTime(); // Returns the GMT time and date time Clock.DateTime( 2 ,DAYLIGHTSAVING_METHOD_US); // Returns the time zone time and date time. } //+------------------------------------------------------------------+
Attachment download
📎 clock_sample.mq4 (2.28 KB)
📎 clock.mqh (6.44 KB)
Source: MQL5 #34301