current time of the current one minute-frame candle

 

i want to  works code  for  current time of the current (one) minute frame candle. how  can be accessed every second


Note that this code is not valid and entered an infinite loop when i run please if anyone can create or have code for this idea

#note 

(((I uploaded a picture to express what is required)))


void OnTick()

  {

//---

    int SECOND;

   datetime    tm=TimeCurrent();

   MqlDateTime stm;

   tm=TimeCurrent();

   TimeToStruct(tm,stm);

   SECOND =(int)stm.sec;



Comment("SECOND : "  + DoubleToString(SECOND, _Digits));



 for (int i =1 ; SECOND<59 ; i++)

 {

  Comment("SECOND : "  +(SECOND), "\n","i : "  + i);

        

 SECOND =(int)stm.sec;


}


  }





Documentation on MQL5: Date and Time / TimeCurrent
Documentation on MQL5: Date and Time / TimeCurrent
  • www.mql5.com
TimeCurrent - Date and Time - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Files:
TIME.jpg  155 kb
 
Db Orc: i want to  works code  for  current time of the current (one) minute frame candle. how  can be accessed every second
  1. Stop thinking “every second,” nothing has changed. Return from OnTick, terminal waits for a new tick, reprocess when called.
  2. There is no such thing as current time of a candle. There is only last known server time (TimeCurrent) and start time of the candle.
 
Db Orc:

i want to  works code  for  current time of the current (one) minute frame candle. how  can be accessed every second


Note that this code is not valid and entered an infinite loop when i run please if anyone can create or have code for this idea

#note 

(((I uploaded a picture to express what is required)))


void OnTick()

  {

//---

    int SECOND;

   datetime    tm=TimeCurrent();

   MqlDateTime stm;

   tm=TimeCurrent();

   TimeToStruct(tm,stm);

   SECOND =(int)stm.sec;



Comment("SECOND : "  + DoubleToString(SECOND, _Digits));



 for (int i =1 ; SECOND<59 ; i++)

 {

  Comment("SECOND : "  +(SECOND), "\n","i : "  + i);

        

 SECOND =(int)stm.sec;


}


  }





If you require, you can use OnTimer() event handler and set EventTimer to 1 second.

OnTimer will be called according to your value.

EDIT: Use the >Code Button< to add code to your post.
 
William Roeder #:
  1. Stop thinking “every second,” nothing has changed. Return from OnTick, terminal waits for a new tick, reprocess when called.
  2. There is no such thing as current time of a candle. There is only last known server time (TimeCurrent) and start time of the candle.

Well sir, thanks for the answer ..The idea that I have is to keep the random price changes that occur to the candle every second in relation to one minute frame, through which, after the changes occur with ASK, I determine the process of buying or selling