50 lines
1.9 KiB
MQL5
50 lines
1.9 KiB
MQL5
|
//+------------------------------------------------------------------+
|
||
|
//| SP_Pedro_Time.mq5 |
|
||
|
//| Copyright 2024, MetaQuotes Ltd. |
|
||
|
//| https://www.mql5.com |
|
||
|
//+------------------------------------------------------------------+
|
||
|
#property copyright "Copyright 2024, MetaQuotes Ltd."
|
||
|
#property link "https://www.mql5.com"
|
||
|
#property version "1.00"
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Expert initialization function |
|
||
|
//+------------------------------------------------------------------+
|
||
|
int OnInit()
|
||
|
{
|
||
|
//---
|
||
|
|
||
|
//---
|
||
|
return(INIT_SUCCEEDED);
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Expert deinitialization function |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void OnDeinit(const int reason)
|
||
|
{
|
||
|
//---
|
||
|
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|
||
|
//| Expert tick function |
|
||
|
//+------------------------------------------------------------------+
|
||
|
void OnTick()
|
||
|
{
|
||
|
//---
|
||
|
// Obtener el tiempo del servidor de trading en segundos
|
||
|
int serverTime = TimeTradeServer();
|
||
|
|
||
|
// Imprimir el tiempo en la consola del terminal
|
||
|
Print("Segundos transcurridos desde el 1 de enero de 1970: ", serverTime);
|
||
|
// Convertir el tiempo en segundos a formato de fecha y hora
|
||
|
string formattedTime = TimeToString(serverTime);
|
||
|
|
||
|
// Imprimir la fecha y hora en la consola del terminal
|
||
|
Print("Fecha y hora actual: ", formattedTime);
|
||
|
|
||
|
// Obtener la fecha y hora actual
|
||
|
//datetime currentTime = TimeCurrent();
|
||
|
|
||
|
|
||
|
}
|
||
|
//+------------------------------------------------------------------+
|