Time in miliseconds

 

Hi, i need to exports tickdatas from MT5 with Time format like : yyyy.MM.dd HH.mm.ss.fff


Please, could you help me ?

i tried with gettickcount but understand nothing.

How is it possible to record seconds ans miliseconds for each tick ?

my script :


  num=FileOpen(nom+".csv",FILE_CSV|FILE_READ|FILE_WRITE|FILE_COMMON);

   FileSeek(num,0,SEEK_END);

   FileWrite(num,TimeToString(iTime(NULL,PERIOD_CURRENT,0))+";" + DoubleToString( SymbolInfoDouble(_Symbol, SYMBOL_ASK) )  + ";" +   DoubleToString( SymbolInfoDouble(_Symbol, SYMBOL_BID) )  

               + ";" +   DoubleToString( SymbolInfoDouble(_Symbol, SYMBOL_LAST) )  + ";" +   DoubleToString( SymbolInfoDouble(_Symbol, SYMBOL_VOLUME_REAL) )  );

   FileClose(num);


it only retuns date time with hour and minutes and i really need also seconds and miliseconds.

 
Frederic Lebre: it only retuns date time with hour and minutes and i really need also seconds and miliseconds.

It does not "only retuns" hours and minutes. Perhaps you should read the manual.
   How To Ask Questions The Smart Way. 2004
      How To Interpret Answers.
          RTFM and STFW: How To Tell You've Seriously Screwed Up.

As far as milliseconds, you will have to use GetTickCount. If you "understand nothing" you need to read the manual again.

 
William Roeder:

It does not "only retuns" hours and minutes. Perhaps you should read the manual.
   How To Ask Questions The Smart Way. 2004
      How To Interpret Answers.
          RTFM and STFW: How To Tell You've Seriously Screwed Up.

As far as milliseconds, you will have to use GetTickCount. If you "understand nothing" you need to read the manual again.

i do not understand why you spend time to answer this. Nothing else to do ?

 
Frederic Lebre: i do not understand why you spend time to answer this. Nothing else to do ?

Because you are wrong. Read the manual and learn why.

 
William Roeder:

Because you are wrong. Read the manual and learn why.

i've been learning english for only two years but i think you should go back to school !!!!

when i write "it only returns" is't about script above. So i'm right, my script ONLY retrurns.....

if i knew that it was impossible i shouldn't have asked help.

 
Frederic Lebre: if i knew that it was impossible i shouldn't have asked help.

Reread #1 and #3 I did not say it was impossible. I said the opposite. Yes, "your script ONLY returns..." So fix your code.

 

I'd look here: https://www.mql5.com/en/docs/marketinformation/symbolinfotick

The SymbolInfoTick() function returns a MqlTick structure for the given symbol. This contains a `time_msc` member with the last tick update time in milliseconds.

You can convert this to a time string with millisecond resolution, e.g. in OnTick() or OnCalculate(), like so:

MqlTick tick;
SymbolInfoTick(Symbol(), tick);
StringFormat("%s.%03d", TimeToString(tick.time_msc / 1000, TIME_DATE | TIME_SECONDS), tick.time_msc % 1000);

If you don't want to live-capture ticks, but rather batch-process them have a look at: https://www.mql5.com/en/docs/series/copyticks

Documentation on MQL5: Market Info / SymbolInfoTick
Documentation on MQL5: Market Info / SymbolInfoTick
  • www.mql5.com
SymbolInfoTick - Market Info - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5