Time function questions

 

Hi brothers

How can I get or which function get the time of high price ?

How can I get the time of the current bar (like if period = 60, how many minutes elapsed right now ) ?

Thank you and God bless you

 
pow:

How can I get or which function get the time of high price ?

You can't get the exact time of High price since this info is not saved by the Terminal. You can however monitor the data stream in real-time, calculate and save this info yourself. If you don't need it to be completely accurate, then u can have a +/- 1 minute accuracy if u analyze the M1 time-series. If u want the time for highest for a large time-frame like H1 for example, then a +/- 1 minute accuracy might be sufficient for your needs.

How can I get the time of the current bar (like if period = 60, how many minutes elapsed right now ) ?

Just use TimeCurrent() and calculate how much time passed since start of current bar... Something like this (did not check it so not sure):

int secs = TimeCurrent() % (Period()*60);    // calculate number of seconds passed since start of current bar (time-frame on chart)
 

Thank you dear Gordon

///You can't get the exact time of High price since this info is not saved by the Terminal. You can however monitor the data stream in real-time, calculate and save this info yourself. If you don't need it to be completely accurate, then u can have a +/- 1 minute accuracy if u analyze the M1 time-series. If u want the time for highest for a large time-frame like H1 for example, then a +/- 1 minute accuracy might be sufficient for your needs.

///In my question I mean the function cause I want use it in indicator

///About second section

int secs = TimeCurrent() % (Period()*60);

this is the needed

 
pow:

In my question I mean the function cause I want use it in indicator

Off the top of my head u can use iHighest(symbol, PERIOD_M1, MODE_HIGH, count, start), but u need to calculate count and start to fit the specific bar in the specific larger time-frame u want to find the highest inner M1 bar for. This function will return the shift in M1 bars, to get the time of that bar use iTime(). Please see -> iHighest(), iTime() (and see the other time-series access functions, u might need them).

 

Thank you very much

You are the best

God bless you

Reason: