function Time in mql4 exist somthing similar in mql5 ??

 
Hi  i look in manual but i not find something similar to function Time ,probably i not see , anyone   know if exist something similar?  thanks
 
faustfHi  i look in manual but i not find something similar to function Time ,probably i not see , anyone   know if exist something similar?  thanks

Articles

Migrating from MQL4 to MQL5

Sergey Pavlov, 2010.05.17 13:32

This article is a quick guide to MQL4 language functions, it will help you to migrate your programs from MQL4 to MQL5. For each MQL4 function (except trading functions) the description and MQL5 implementation are presented, it allows you to reduce the conversion time significantly. For convenience, the MQL4 functions are divided into groups, similar to MQL4 Reference.


3. Predefined Variables

MQL4   MQL5  Description
datetime Time[]
datetime Time[];
int count;   // number of elements to copy
ArraySetAsSeries(Time,true);
CopyTime(_Symbol,_Period,0,count,Time);
Time
Series array that contains open time of each bar of the current chart. Data like datetime represent time, in seconds, that has passed since 00:00 a.m. of 1 January, 1970.
CopyTime, ArraySetAsSeries
 
  1. in MT4, Time is not a function; it is a predefined array.

  2. There are no predefined arrays in MT5 unless you define them. Using global arrays like Open[], Close[], Low[], High[] in custom indicator for MetaTrader 5 - MQL5 programming forum (2023)

 

thanks  but sorry continue to not understund  in this

3. Predefined Variables

MQL4   MQL5  Description
datetime Time[]
datetime Time[];
int count;   // number of elements to copy
ArraySetAsSeries(Time,true);
CopyTime(_Symbol,_Period,0,count,Time);
Time
Series array that contains open time of each bar of the current chart. Data like datetime represent time, in seconds, that has passed since 00:00 a.m. of 1 January, 1970.
CopyTime, ArraySetAsSeries

i saw  mql4  Time[] but  also  in mql5  therfore Time[]  exist in both  ?, how Cn use it ? have some exmple?  thanks

Time - Predefined Variables - MQL4 Reference
Time - Predefined Variables - MQL4 Reference
  • docs.mql4.com
Time - Predefined Variables - MQL4 Reference
 
faustf #thanks  but sorry continue to not understund  in this [ . . . ] i saw  mql4  Time[] but  also  in mql5  therfore Time[]  exist in both  ?, how Cn use it ? have some exmple?  thanks

There is no Time[] in MQL5, but the article shows an example of how to define it. For example, considering that you need to check the time of the current candle and the previous 3 candles and prefer to use Time[]... You can do the following in MQL5:

   datetime Time[];
   if(!ArraySetAsSeries(Time, true))
     {
      Print(__FUNCTION__, " - Error indexing array like in timeseries.");
      return;
     }
   if(CopyTime(_Symbol, _Period, 0, 4, Time) < 0)
     {
      Print(__FUNCTION__, " - Failed to copy opening time data.");
      return;
     }

After the definition above, you can check/use Time[0], Time[1], Time[2] and Time[3], understand?

 
Vinicius Pereira De Oliveira #:

There is no Time[] in MQL5, but the article shows an example of how to define it. For example, considering that you need to check the time of the current candle and the previous 3 candles and prefer to use Time[]... You can do the following in MQL5:

After the definition above, you can check/use Time[0], Time[1], Time[2] and Time[3], understand?

thanks now is clear