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
The expert advisor uses the indicator on a different timeframe. On tests the EA shows incorrect data from the indicator.
The EA itself works on M5, and the indicator on H4. Indicators which are called on the same timeframe (M5) return the correct values.
Returned values are similar to the indicator values, but are different from the real values which are visible when the indicator is applied to the price chart window.
What is the problem?
Example code of indicator call:
Possible causes:
- the rule of the first 14 bars is not respected: https://www.mql5.com/ru/articles/15 in the indicator;
- the correlation between the current and the preset TF is not complied with (for example the serial number of the bar with the required value of the extremum on another TF will probably be different, than on the preset one, and consequently the high, low, etc. will be entirely different) - all this depends on the specific realization of the indicator; you should clearly understand what exactly needs to be correlated and recalculate by the formula using the ratio of different periods;
- maybe, old indicator values from the previous tick are left in the buffer, and it may be necessary to reinitialize the buffer with empty values: ArrayInitialize(array,EMPTY_VALUE).
Possible causes:
- the rule of the first 14 bars is not observed: https://www.mql5.com/ru/articles/15 in the indicator;
- Correlation between the current and the preset TF is not observed (for example the serial number of the bar with the required value of an extremum in another TF must be different, than in the preset one, and consequently the high, low, etc. will be different) - all this depends on the particular implementation of the indicator;
- maybe, old values from the previous tick are left in the indicator, and it may be necessary to reinitialize the buffer with empty values: ArrayInitialize(array,EMPTY_VALUE).
1. the indicator is drawn on all bars on the price chart.
2. Everything is OK here.
3. did not help
The reference says that the date/time is allowed to be represented like this:
D'12:00:00'
I assign a value to a variable of datetime type:
A warning pops up on compilation:
Why?
Because no date is specified, only the time 12:00:00 is specified. The date is spelled with a full stop, not a colon.
The reference says that:
Either the date (year, month, date) or the time (hours, minutes, seconds) or all together can be omitted. The range of values is from 1 January 1970 to 31 December 3000.
Examples:
D'2004.01.01 00:00' // New Year
D'1980.07.19 12:30:27'
D'19.07.1980 12:30:27'
D'19.07.1980 12' //new year d'1980.07.19 12:00:00'
D'01.01.2004' //equivalent D'01.01.2004 00:00:00'
D'12:30:27' //equivalent to D'[compile date] 12:30:27'
D' '//equivalent to D'[compile date] 00:00:00''
Or am I misunderstanding this?
The EA itself runs on M5 and the indicator on H4. The indicators that are called on the same timeframe (M5) return the correct values.
I continue to insist on the second point.
You yourself write that on the same TF the correct values are returned. On different ones, of course, values that are not expected for the current TF will be returned.
The returned values are similar to the indicator values, but they are different from the real values that are visible when the indicator is attached to a price chart window.
If the indicator is able to return the correct values in accordance with one or another TF, but is not able, say, on M5, to display what it does on H4, then what can we expect from the returned values when working together with the Expert Advisor that is not on the same TF?
The reference says that:
Either the date (year, month, date) or the time (hours, minutes, seconds) or all together can be omitted. The range of values is from 1 January 1970 to 31 December 3000.
Examples:
D'2004.01.01 00:00' // New Year's Eve
D'1980.07.19 12:30:27'
D'19.07.1980 12:30:27'
D'19.07.1980 12' //new year d'1980.07.19 12:00:00'
D'01.01.2004' //equivalent D'01.01.2004 00:00:00'
D'12:30:27' //equivalent to D'[compile date] 12:30:27'
D' '//equivalent to D'[compile date] 00:00:00''
Or am I misunderstanding this?
Yes yes, you got it right, I wasn't paying attention in a hurry.
Apparently it was like that originally and then it was cancelled and the certificate was not corrected.
Anyway the question still stands, is this a help inaccuracy or a bug?
Urain:
...
Anyway the question still stands, is this a help inaccuracy or a bug?
An example of a script:
That's how it works. I just don't like the warnings after compiling)). Maybe one of the developers can comment.Either way the question still stands, is it an inaccuracy in the help or a bug?
The expert advisor uses the indicator on a different timeframe. On tests the EA shows incorrect data from the indicator.
The EA itself works on M5, and the indicator on H4. Indicators which are called on the same timeframe (M5) return the correct values.
Returned values are similar to the indicator values, but are different from the real values which are visible when the indicator is applied to the price chart window.
What is the problem?
Example code of indicator call:
The AS_SERIES flag cannot be set in multidimensional arrays and in static arrays.
Try
or as follows