Convert time to double and vice versa – library MetaTrader 4

I’ve found these small functions very useful when trying to pass datetime through Global Variables.

Example:

You can use it to save a value

GlobalVariableSet(name,TimeToDouble(date_time));

and

datetime date_time=DoubleToTime(GlobalVariableGet(name));

when you want to get the value back.

📈 ROBOTFX MetaTrader Expert Advisors and Indicators to maximize profits and minimize the risks