MQL5Book/Scripts/p1/GoodTime2.mq5

43 lines
3.1 KiB
MQL5
Raw Permalink Normal View History

2025-06-12 13:40:26 +01:00
<EFBFBD><EFBFBD>//+------------------------------------------------------------------+
//| GoodTime2.mq5 |
//| Copyright 2021, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Ltd."
#property link "https://www.mql5.com"
#property version "1.00"
// <EFBFBD>O<EFBFBD><EFBFBD><EFBFBD><EFBFBD>eQ<EFBFBD>Spe(Wscript <EFBFBD><EFBFBD>ЏL<EFBFBD><EFBFBD>v<EFBFBD>eP <EFBFBD>9_<EFBFBD>Q<EFBFBD>[݋Fh
#property script_show_inputs
// input <EFBFBD> ُ/fN*NY萓<EFBFBD>eQ<EFBFBD>vparam
// uint <EFBFBD> unsigned integer
input uint GreetingHour = 0; // Greeting Hour (0-23)
//+------------------------------------------------------------------+
//| Return greeting for given time of day (hour) |
//+------------------------------------------------------------------+
string Greeting(int hour)
{
string messages[3] = {"Good morning", "Good day", "Good evening"};
return messages[hour % 24 / 8];
}
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
// Print to Experts console
Print(Greeting(GreetingHour), ", ", Symbol());
// Comment on the chart
Comment(Greeting(GreetingHour), ", ", Symbol());
// Popup
Alert(Greeting(GreetingHour), ", ", Symbol());
}
//+------------------------------------------------------------------+