Questions from Beginners MQL5 MT5 MetaTrader 5 - page 15

 
Alphazavr:

A word of advice. There are two variables of datetime type. How can I find out the time difference between two points in MQL5?

... In other words, time1 = 21:20, time2 = 21:35, how do I get 15 minutes?

... For C++, there is such a function:http://www.cplusplus.com/reference/clibrary/ctime/difftime/, but I can't find it in MQL5.

Just subtract one from the other. These are regular int64 numbers.
 
Alphazavr:

2 Karlson:

I noticed it straight away, it's just the 1970s that confuse me. So far I don't have a good solution, so I'm doing this:

Print("Connection is restored after ", TimeToString(TimeLocal()-disconnectTime,TIME_MINUTES), " of waiting."); 


You have the time in the form " hh:mi ". Get time as yyyy.mm.dd + hh:mi
TIME_DATE|TIME_MINUTES


 
Alphazavr:

2 Karlson:

I noticed it right away, it's just the 1970s that confuse me.

This is zero in the time countdown. 15 minutes remain.They can be monitored through the MqlDateTime structure.
Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура даты
Документация по MQL5: Стандартные константы, перечисления и структуры / Структуры данных / Структура даты
  • www.mql5.com
Стандартные константы, перечисления и структуры / Структуры данных / Структура даты - Документация по MQL5
 
2 Renat, Silent, Karlson: Thank you.
 
Desead:
Is it possible to write an Expert Advisor and run it in the strategy tester in such a way, that the indicators which are used in the Expert Advisor are not displayed in the Strategy Tester? And is it possible to increase the font size with Comment when displaying comments?

1. You can. Create a special template for the expert to test <expert_name>.tpl

2. You cannot. For your purposes, use the "text label" object(OBJ_LABEL) and set a font size you need (OBJPROP_FONTSIZE)

 

How to solve a problem like this.

There are two arrays of zigzag extrema, High and Low, and a TimeBuffer array

It is unknownwhich array, High or Low, begins to fill first.

We need to find the anchor points for the objects as shown in the screenshot.

Let the first object (1) be at the Low extremum ; the second object (2) have the same bar but the bar price is High (3). Accordingly, (3) is at theHigh extremum, (4) is the time object (3) at the price (5), etc.

Twisted two variants: two variables and two flags; two additional arrays. As a result, I only got completely confused.

 
You need to find when and at what price was the price extremum of the zigzag from the EA?
 

Nah, the extremes (1,3,5,7,9) are plotted against.

Object 2 has the time of the 1st extremum (low) and the price of the 3rd (nai). And 4,6 etc. are the same, with a shift. These are the even ones how to find/build.

 

And in parallel, another question on the same subject.

How to pull out anchor points/extremes from two arrays? For example, to draw trend points through 1-3 points, 3-5, 5-7... They are indexed differently in the arrays.

Through a variable, look for the first nonempty value, store it, look for the second one in another array, compare... In general, is it easier to zigzag with a single buffer?

Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Способы привязки объектов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Способы привязки объектов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы объектов / Способы привязки объектов - Документация по MQL5
 

(Please file this down but please))) I really thought I could not do it, but something came up. Again, I do not pretend to be right. This is not my bread )))

If something is not clear, then specify. I do not know how to count the zigzag, which is recalculated, so marks have a chance to disappear, as well as appear redundant. on peaks, but there zigzag no longer.

Files:
Reason: