Download MetaTrader 5
To add comments, please log in or register
Interested in the Market activity? Come and track!
abdi
193
abdi 2013.04.18 18:34 
Hi Can we change the time format in mql4 from 2013.09.09 13:15 to 30130909 1315 Any help is appreciated and thnx in advance
whroeder1
14239
whroeder1 2013.04.18 20:12  
abdI: Can we change the time format i
NO
Alain Verleyen
Moderator
30298
Alain Verleyen 2013.04.18 21:39  
abdI:
Hi Can we change the time format in mql4 from 2013.09.09 13:15 to 30130909 1315 Any help is appreciated and thnx in advance
It all depends on what you are talking about, what do you do exactly ?
abdi
193
abdi 2013.04.19 11:36  
hi thanks for u  WHRoeder , angevoyageur ,  i want to show the time on the screen of my mt4 terminal as 30130909 1315 (yyyymmdd hhmm) for example  using  

ObjectCreate(".....", OBJ_LABEL, 0, 0, 0);
ObjectSetText("....",DoubleToStr((..);


and after getting the time format as the above then i can  do any mathematical operations on it by considering it to be a (number)  not (date)  

 i know that we can get time format as 30130909 1315 by creating and saving the price data as  .prn, file but 

am looking for a way to get it directly on the screen of my mt4 terminal " if i could ".

Tjipke de Vries
6298
Tjipke de Vries 2013.04.19 12:21  
abdI:
hi thanks for u  WHRoeder , angevoyageur ,  i want to show the time on the screen of my mt4 terminal as 30130909 1315 (yyyymmdd hhmm) for example  using  



and after getting the time format as the above then i can  do any mathematical operations on it by considering it to be a (number)  not (date)  

 i know that we can get time format as 30130909 1315 by creating and saving the price data as  .prn, file but 

am looking for a way to get it directly on the screen of my mt4 terminal " if i could ".

datetime  timeformat   =  TimeCurrent();

Print("  Time  " ,timeformat);

 

What output do you have this way ??? 

abdi
193
abdi 2013.04.19 12:48  
deVries:

 

What output do you have this way ??? 


hi and thanks for you deVries

am not good in mql4 programming, but as i know the print function will send the output to the log file ..(am not sure as am beginner )

 can we show the output on the screen of mq4 terminal ? using object creat?

abdi
193
abdi 2013.04.19 12:52  

 and here what i found in the log file

 

 

15:29:32 #time EURUSD,Daily:   Time  1366385328
15:29:32 #time EURUSD,Daily:   Time  1366385328
abdi
193
abdi 2013.04.19 12:58  

oh ....what a big mistake ..................about the needed time format.......it should be.20130909 1315  not...30130909 1315.

....... 

in all of my previous posts i made the same mistake.....sorry   .hope any Moderator to correct it 

Simon Gniadkowski
Moderator
17994
Simon Gniadkowski 2013.04.19 13:08  
abdI:

oh ....what a big mistake ..................about the needed time format.......it should be.20130909 1315  not...30130909 1315.

....... 

in all of my previous posts i made the same mistake.....sorry   .hope any Moderator to correct it 

You can construct the string using  StringConcatenate(int, int, int, int, )  with  TimeYear(TimeCurrent() )  TimeMonth(TimeCurrent)  TimeDay(TimeCurrent)   etc.
abdi
193
abdi 2013.04.19 13:13  
RaptorUK:
You can construct the string using  StringConcatenate(int, int, int, int, )  with  TimeYear(TimeCurrent() )  TimeMonth(TimeCurrent)  TimeDay(TimeCurrent)   etc.


hi

i will tray this function  ....

thanks for u RaptorUK . 

whroeder1
14239
whroeder1 2013.04.19 13:16  
  1. abdI: it should be.20130909 1315  not...30130909 1315. (yyyymmdd hhmm)
    From TimeToStr - MQL4 Documentation TimeToStr returns "yyyy.mm.dd hh:mi". So strip out the separators.
    Not compiled, not tested.
    string TimeToStringNS(datetime when){
      string withSep = TimeToStr(when),              // "yyyy.mm.dd hh:mi"
             withOut = StringSubstr(withSep,  0, 4)  // yyyy
                     + StringSubstr(withSep,  5, 2)  // mm
                     + StringSubstr(withSep,  8, 5)  // dd hh
                     + StringSubstr(withSep, 14, 3); // mi
      return(withOut);                               // "yyyymmdd hhmi"
    }
    Not compiled, not tested.

  2. RaptorUK: You can construct the string using  StringConcatenate(int, int, int, int, )  with  TimeYear(TimeCurrent() )  TimeMonth(TimeCurrent)  TimeDay(TimeCurrent)  etc.
    Using TimeMonth(x), etc., will not result is 2 digit values but instead yyyymd hm in general.
/ /12
To add comments, please log in or register