[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 102

 
Chuma:

I meant when there are only quotes in brackets: Comment("")

Clears previous comments.
 
gogent:
Comment() displays the text not in the box but in the upper left corner of the chart
Yes, that's right.
 
Zhunko:
Will clear the previous comments.
Thank you
 

Hi all !

Please help me to understand this example from MQL4 primer. This is the place:

I have underlined in red what I don't understand. Why does IndicatorCounted() return 299 on Tick 3 ? The previous candle hasn't changed since the last indicator call (Tick 2), and it is the 300th candle. So the function should return 300.

And one more question: could you please tell me if in this picture Open of the last bar is the price that came on Tick 2 or on Tick 3 ?

Thanks to all, who will not pass by the suffering :-))

 
Skander:

Hi all!

Help me with an example from the MQL4 tutorial. This is the place:

I underlined in red what I didn't understand. Why will IndicatorCounted() return 299 on Tick 3 ? After all

At time t2 the bar is not yet considered finished, because technically the timeframe period has not yet ended. We have no way to determine in advance if this is the last tick of the bar or if there will be more ticks before the next bar starts. And consequently, Indicator Counted returns what it should according to the documentation: the number of bars counted at time t2 excluding the zero bar (again at time t2), i.e. 300-1=299.

 
alsu:

At time t2 the bar is not yet considered finished, because technically the timeframe period has not yet ended. We have no way to determine in advance if this is the last tick of the bar or if there will be more ticks before the next bar starts. And consequently, Indicator Counted returns what it is supposed to return according to the documentation: the number of bars counted at time t2 excluding the zero bar (again at time t2), i.e. 300-1=299.


I see what you mean: you describe the situation at time t2, but the textbook says that at time t3 the Indicator Counted function returns the same number as at time t2. It's not clear to me, why does it do that? This fragment here:

Or is the situation at time t2 described here?

 
Skander:

I see what you mean: you describe the situation at time t2, but the textbook says that at time t3 the Indicator Counted function returns the same number as at time t2. It's not clear to me, why does it do that? This paragraph here:

Or is the situation at time t2 described here?

No, at time t3. The point is that t3 is the first tick of a bar, and that means, because calculations have not yet been made on it, the value of IndicatorCounted() has not yet had time to change - it only happens after the function start() finishes its work. This is quite logical - the function gives the number of calculated bars, so there's no sense to change its value until at least one tick of the given bar has been calculated. Therefore at the moment t3 we still see the value 299, but at the next tick it will be 300.

Is it clearer?

 
Folks, please advise what is a header file (MQH), it can be created in the editor. The editor's help doesn't say anything about it.
 
Las-tochka:
Folks, tell me what is a header file (MQH), it can be created in the editor. The editor's help doesn't say anything about it.

Library With functions, you can create it in MetaEditor, Notepad ...

The compilation is not required.The include includes the necessary functions in the expert when compiling, and the Libraries library ex4 is compiled and imported (i.e. constantly refers to it for the necessary f-ms).
 
Las-tochka:
Folks advise what is, header file (MQH), you can create it in the editor. The editor's help doesn't say anything about it.


I think the header file in MKL is also worth looking at from this angle:

as we know there are no classes in the language, but this is convenient. Some kind of class can be created with a header file. In it, we create an environment that describes the object (variables) and define functions that will work with this environment. Pretty handy (assuming the project is complex enough).

Reason: