Questions from Beginners MQL5 MT5 MetaTrader 5 - page 867

 
Kirill Belousov, any idea how to find out how many seconds the plan should have in a day/month/week?
 
Aleksey Vyazmikin:

I need to get the time 23:45 in this case (in general I have not M5, but M1 current TF, but it does not matter) - this is the time of the last bar of the current TF in the structure of the last bar of the TF above. The shift on the chart is 1 bar for H1, but there may be another shift, let's say I need information at 11 o'clock, i.e. the shift will be 2.

Aleksey, count how many people cannot understand what you need.

At least try to formulate the problem clearly. What you need to get and at what time on what period of the chart for what TF.

 
Alexey Viktorov:

Alexei, count how many people can't figure out what you want.

At least try to formulate the task clearly. What you need to get and at what time on what period of the chart for what TF.

Well,Kirill Belousov has understood me, while two other people didn't, judging by their replies.

I need a universal function that works with all TFs, while the data are needed at any time.

I don't know what is not clear, so it's difficult to explain - I need leading questions, apparently.

But, once again, I need to know the time of the last occurrence of a bar of the specified TF in the structure of the current TF. For example in a standard situation, the current TF I have is M1, I want to know the time of the last bar in the current TF, equal to the hourly TF that closed 1 bar or more ago. In numbers - it is 10:30, I need to know what time it was when the last candle opened last hour - and it will be 23:49, and if it is 11:30, then usually it will be 10:59.

Does that make more sense?

 
Aleksey Vyazmikin:
Kirill Belousov, any idea how to find out how many seconds the plan should have in a day/month/week?

https://www.mql5.com/ru/docs/common/periodseconds

Документация по MQL5: Общие функции / PeriodSeconds
Документация по MQL5: Общие функции / PeriodSeconds
  • www.mql5.com
[in]  Значение периода графика из перечисления ENUM_TIMEFRAMES. Если параметр не указан, то возвращается количество секунд текущего периода графика, на котором запущена программа.
 
Aleksey Vyazmikin:

But, once again, I need to know the time of the last bar appearance of the specified TF in the structure of the current TF. For example, in a standard situation, my current TF is M1, I want to know the time of the last bar in the current TF, equal to the hourly TF that closed 1 bar or more ago. In numbers - it is 10:30, I need to know what time it was when the last candle opened last hour - and it will be 23:49, and if it is 11:30, then usually it will be 10:59.

Is that clearer?

Alexey, be careful - the minute TF has no structure whatsoever, as it is the minimum standard TF.

Therefore it is very difficult to "wade through" your formulation of the problem. Repeating the same thing with inappropriate terms does not make the situation any clearer.)

Note how I phrased my answers to your questions - you can figure it out there without a bottle and mushrooms (or psychics, which I had to do to understand you :) )

 

Thanks, but you can't specify a bar number there, and without that month, how will it get it right? It will only tell you about the current one.

 
Kirill Belousov:

Alexey, be careful - the minute TF has no structure, as it is the minimum standard TF.

Therefore it is very difficult to "wade through" your wording of the problem. Repeating the same thing with inappropriate terms does not make the situation any clearer.)

Pay attention to how I have formulated my answers to your questions - they can be understood there without a bottle and mushrooms (or psychics, that I had to involve to understand you :) )

Yeah I was talking about a different structure there of course, not in that sense at all! But in the sense that the bar of any TF is a structure that can break down into subsets from the lower TFs.

When you don't communicate in programming language, it's difficult to express your thoughts, I appreciate that you get the point, thank you.

 

For a shift of one bar, I have so far done this

      datetime         StartDt=iTime(Symbol(),TF_iDeltaP,_Shift);
      int              N_bar=iBarShift(Symbol(),PERIOD_CURRENT,iTime(Symbol(),TF_iDeltaP,0));//номер текущего бара
      datetime         StopDt=iTime(Symbol(),PERIOD_CURRENT,N_bar+1);
 
Where did my question go?
Reason: