Errors, bugs, questions - page 202

 
Interesting:

Now, unlike MT4, the period does not mean the number of seconds in a period.

Read more carefully, I wrote about _Period, not about PeriodSeconds. And don't clutter up the page with your perception errors, please.
 
ANG3110:
It never showed the number of seconds, even in MT4 dear... But the minutes in MT4 it showed clearly. What does _Period on H1 chart show then? Seems like a serious bug to me.
ANG3110:
Read carefully, I wrote about _Period, not about PeriodSeconds. And do not clog the page with your perception errors, please.
Already fixed. The general point is, using PeriodSeconds we get exactly seconds in a period, and then do whatever you like with them...

So H1 = 16385 is not nonsense, it is the numeric representation of H1 in ENUM_TIMEFRAMES.


Read Period-u help

Period

Returns the timeframe value of the current chart.

ENUM_TIMEFRAMESPeriod();

Returned value

Contents of the _Period variable, holding the timeframe value of the current chart. Value can be one ofthe ENUM_TIMEFRAMESenumerationvalues .

PS

Thus,it returns not the number of minutes corresponding to the period (as it was in MT4), but the element of the enumeration ENUM_TIMEFRAMES(or its numeric representation, if necessary)...

 
Interesting:
Already corrected. The general point is, using PeriodSeconds we get exactly seconds in a period, and then do whatever you like with them...

So H1 = 16385 is not nonsense, but a numerical representation of H1 in ENUM_TIMEFRAMES.

Damn, what a mess. Earlier everything was simple and easy - just write Period() and you'll get minutes. Now you get some service identifiers that you don't really need for your work. Ok, I'll try to get the minutes in seconds.
 

So, if I request _Period on H1 and get this ENUM_TIMEFRAMES= 16385, how can I get minutes from it?

Although, of course, divide PeriodSeconds()/60 is not worth anything. But what are these identifiers and how to work with them?

 
ANG3110:

So, if I request _Period on H1 and get this ENUM_TIMEFRAMES= 16385, how can I get minutes from it?

I've been using this function in my migration library for 11 months and it worked fine so far

//Fumction PeriodToMinute
int PeriodToMinute(ENUM_TIMEFRAMES Value)
{
//----------------------------------------------------------------------------//
//Work variables
int Result; //Returned importance
//----------------------------------------------------------------------------//
Result = PeriodSeconds(Value)/60;
//----------------------------------------------------------------------------//
return(Result);
//----------------------------------------------------------------------------//
}

ANG3110:

Although, of course, you should divide PeriodSeconds()/60 by itself. But still, what kind of identifiers these are and how to work with them.

This question can be referred to the basics of OOP. It concerns identifiers and enumerators. Please refer to the Reference or any good books on C++ programming for details.

This has already been implemented in MQL4, but not so obvious.

Each identifier (whether written in MQL5 or created by user) can have its own "number representation".

To put it simply (I'm explaining it as best I can)...

You may think it's for external environment compatibility, e.g. DLL or another one (that has no idea about MQL and its identifiers).

So, if you need to work with a period inside MQL5 program, it would be reasonable to use identifier PERIOD_H1 of enumeration ENUM_TIMEFRAMES.

But if you need to tell the external environment (for example DLL) that we are working with period H1, it is easier to do with numerical representation of this identifier, in our case it is 16385.

 
ANG3110:

So, if I request _Period on H1 and get this ENUM_TIMEFRAMES= 16385, how can I get minutes from it?

Although, of course, I should divide PeriodSeconds()/60. But what are these identifiers and how should I work with them?

like this

int minute = PeriodSeconds(_Period)/60;
 
Interesting:

I have been using this function in my migration library for 11 months now, and so far it has been fine

Got it. Thanks for the reply!
 
sergey1294:

like this

Thank you too!
 

Developers.

1. OHLC string starts winking under some conditions. Revealed when testing EA on single core computer (CPU probably overloaded)...

2. Is it possible to place the list of classes and their functionality (the stuffing) in the navigator, just like it is done in Delphi (because it is not very convenient to work with the list of procedures and functions of a module)?

 
Ashes:

Attempted to save tester report in Open XML format. Minutes of waiting (Pentium 4, 3.0GHz), application not responding, terminal.exe process was running rampant in task manager (about 50% of CPU) eating up RAM (about 250Mb), Result - nothing. MT5 only responds, no quotes coming in (connection status indicator with grey spinning circle). A second try, it is the same. The window "Tools" has 2 journal entries "MemoryException 107878464 bytes not available", the time corresponding to the attempt to receive a report in OpenXML.
The HTML file was generated almost instantly (about 12 Mb). It takes a long time to open, but it's not MT5's fault...

I repeat. All the same, but with build 358. Only it takes even more time. There is a dependence on report size - short report is processed without problems.
Reason: