Errors, bugs, questions - page 2469
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I'll know ) then hack
I am transferring a program from MQL4 to MQL5.
I have faced this error.
On timeframes up to m30 the Period() value is correct.
2019.05.22 17:45:38.628 TestStat (GBPUSD,M15) 4854 Period()=15
2019.05.22 17:46:08.267 TestStat (GBPUSD,M30) 4854 Period()=30
From timeframe H1 I get incomprehensible values.
2019.05.22 17:31:07.446 TestStat (GBPUSD,H1) 4854 Period()=16385
2019.05.22 17:46:39.362 TestStat (GBPUSD,H4) 4854 Period()=16388
2019.05.22 17:46:55.552 TestStat (GBPUSD,D1) 4854 Period()=16408
Terminal version build 2057 dated 21 May 2019.
Thank you.
In the description:
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 .
See also
PeriodSeconds, Chart Periods, Date and Time, , Object Visibility
=================
That's not very well done. It should be correctly written in the description. You should not look for the source of the problem on the forum.
It turns out that Period() won't give out the value of the current timeframe as it says:The value can be one of the values of enumeration ENUM_TIMEFRAMES.
But something else entirely.
Please correct the language description for developers.
We have the following results on ArrayResize capacity MT5(build 2057):
Result:
Description:
Contents of the _Period variable, which stores the timeframe value of the current chart. The value can be one of the values of ENUM_TIMEFRAMESenumeration.
This is not done well. It should be correctly written in the description. You should not look for the source of the problem on the forum.
So nowhere is it written that this value equals the period in minutes (as it was in quad).
https://www.mql5.com/ru/articles/81
That's where the link article starts.
So nowhere does it say that this value is equal to the period in minutes (as it was in fours).
https://www.mql5.com/ru/articles/81
This is where the article on the link starts.
There is a description of the language that says: Value can be one of the values of ENUM_TIMEFRAMESenumeration.
See the language description further down:
Graph periods
All predefined chart periods have unique identifiers. The PERIOD_CURRENT identifier means the current period of the chart, at which the mql5 program is running.
ENUM_TIMEFRAMES
Identifier
Description
PERIOD_CURRENT
Current period
PERIOD_M1
1 minute
PERIOD_M2
2 minutes
PERIOD_M3
3 minutes
PERIOD_M4
4 minutes
PERIOD_M5
5 minutes
PERIOD_M6
6 minutes
PERIOD_M10
10 minutes
PERIOD_M12
12 minutes
PERIOD_M15
15 minutes
PERIOD_M20
20 minutes
PERIOD_M30
30 minutes
PERIOD_H1
1 hour
PERIOD_H2
2 hours
PERIOD_H3
3 hours
PERIOD_H4
4 hours
PERIOD_H6
6 hours
PERIOD_H8
8 hours
PERIOD_H12
12 hours
PERIOD_D1
1 day
PERIOD_W1
1 week
PERIOD_MN1
1 month
======================
And nowhere in the description does it say that this value is in seconds.
The description should say it all.
And when you have to look up some other articles, that's too bad.
Thanks again toTheXpert for providing the code.
We have the following results on ArrayResize capacity MT5(build 2057):
1. The first ArrayResize is very important, it really allocates memory taking into account size + reserved_size and sets capacity.
2. All subsequent ArrayResize executions with a new value of reserved_size have no effect on the amount of allocated memory and capacity, respectively.
3 New memory allocation is performed only when capacity is exceeded and in this case size + reserved_size is used again to determine the amount of allocated memory and set a new capacity.
4. A value of reserved_size < 0 releases the reserved memory to size size.
And nowhere in the description does it say that this value is in seconds.
So it's not in seconds...
There is a language description that says: Value can be one of the ENUM_TIMEFRAMESenumeration values .
See further in the language description:
Graph periods
All predefined chart periods have unique identifiers. The PERIOD_CURRENT identifier means the current period of the chart, at which the mql5 program is running.
ENUM_TIMEFRAMES
======================
And nowhere in the description does it say that this value is in seconds.
The description should say it all.
And when you have to go through some other articles, it's too bad.
Who told you that these are values in seconds?
There is a language description that says: Value can be one of the values of enumeration ENUM_TIMEFRAMES.
See further in the language description:
Graph periods
All predefined chart periods have unique identifiers. The PERIOD_CURRENT identifier denotes the current period of the chart, at which the mql5 program is running.
ENUM_TIMEFRAMES
Identifier
Description
PERIOD_CURRENT
Current period
PERIOD_M1
1 minute
PERIOD_M2
2 minutes
PERIOD_M3
3 minutes
PERIOD_M4
4 minutes
PERIOD_M5
5 minutes
PERIOD_M6
6 minutes
PERIOD_M10
10 minutes
PERIOD_M12
12 minutes
PERIOD_M15
15 minutes
PERIOD_M20
20 minutes
PERIOD_M30
30 minutes
PERIOD_H1
1 hour
PERIOD_H2
2 hours
PERIOD_H3
3 hours
PERIOD_H4
4 hours
PERIOD_H6
6 hours
PERIOD_H8
8 hours
PERIOD_H12
12 hours
PERIOD_D1
1 day
PERIOD_W1
1 week
PERIOD_MN1
1 month
======================
And nowhere in the description does it say that this value is in seconds.
The description should say it all.
And when you have to go through some other articles, that's too bad.
You should never rely on an enumeration value.
Use PeriodSeconds().