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 don't understand what's wrong. It's a line of minima.
Just in case, copy the code again, I've changed it periodically there, maybe you have an old version
Yes yes, I have to change the version when editing the code.
AUDUSD seems to be OK.
I will go over EURUSD for the solder years. It will be long.
I would like to add week and month at once, if that's not too much trouble ? And shift the labels like on the example.
So as not to look at the graph ten times. (already know the story by heart).
I think I can manage 8 pairs in a month.
I won't get into your code myself ( I will study the process quietly with classes and so on using your example).
Almost forgot (to make an alert like warning if there is no history or the line has not changed its values)
New version. Here it draws three periods: day, week and month. There is a but, I will write below.
The nuance is that in one case we are comparing the previous day to the history and in the other we are comparing the previous week. It turns out that yesterday may belong to the current week, but its maximum may be higher than the maximum of the previous week.
And because we are comparing days to days and weeks to weeks, it may turn out that the lines of the day highs are higher than the week highs. Like here:
But that's your logic, think whether you need it or not.
By the way, there is an out-of-array error as well:
The loop goes through the array of daily bars, and we select elements from the array of weekly bars.
Thanks to Dmitry Fedoseev for the idea of getting the number of the week of the year.
I found it in this article:https://www.mql5.com/ru/articles/599
Well done, Dima!By the way, there is an out-of-array error as well:
The loop goes through the array of daily bars, while we select elements from the array of weekly bars.
There is an obvious error here, this line was added in the process of discussion and copy-paste played its role.
It was so from the beginning and going outside the array is still relevant.
We may seem to forget about the error array out of range in, because you did not feel lazy and provided much more advanced code (many thanks to you for that).
But I still want to understand what the problem is (since this array is accessed from other places in the EA, and what's going on there remains a mystery)
I have noticed ( Where is the returned value of the int type saved? You passed all data into the function, but didn't get anything from it) I added .
It was like this:
ArrayCopyRates(Bar_data_D1,_Symbol,PERIOD_D1); // Copies bar data of the specified chart into an array and returns the number of copied bars
ArrayCopyRates(Bar_data_W1,_Symbol,PERIOD_W1); // Copies data of bars for a specified chart into an array and returns number of copied bars
ArrayCopyRates(Bar_data_MN1,_Symbol,PERIOD_MN1); // Copies data of bars of a specified chart into an array and returns number of copied bars
Now it looks like this:
ACR_D1 = ArrayCopyRates(Bar_data_D1,_Symbol,PERIOD_D1); // Copies bar data of the specified chart into an array and returns the number of copied bars
ACR_W1 = ArrayCopyRates(Bar_data_W1,_Symbol,PERIOD_W1); // Copies data of bars for a specified chart into an array and returns number of copied bars
ACR_MN1 = ArrayCopyRates(Bar_data_MN1,_Symbol,PERIOD_MN1); // Copies data of bars in a specified chart into an array and returns the number of copied bars
Output the value in the som
2020.12.12 16:51:31.536 2020.02.10 00:05:00 _Test AUDUSD,H1: i = 1001 Bar_data_D1 [i][2] = 0.7633799999999999
2020.12.12 16:51:31.536 2020.02.10 00:05:00 _Test AUDUSD,H1: i = 1002 Bar_data_D1 [i][2] = 0.76147
2020.12.12 16:51:31.536 2020.02.10 00:05:00 _Test AUDUSD,H1: i = 1003 Bar_data_D1 [i][2] = 0.75097
2020.12.12 16:51:31.536 2020.02.10 00:05:00 _Test AUDUSD,H1: array out of range in '_Test.mq4' (150,59)
2020.12.12 16:51:31.537 2020.02.10 00:05:00 Testing pass stopped due to a critical error in the EA
2020.12.12 16:51:31.537 AUDUSD,H1: 65147 tick events (73 bars, 9291875 bar states) processed in 0:00:02.407 (total time 0:00:05.672)
Why is so little history copied into the array?
And where and how do these values come from in the first place?
By the way, there is an out-of-array error as well:
The loop goes through the array of daily bars, and we select elements from the array of weekly bars.
We should immediately understand the size of the array of the daily TF and time it and not go beyond the time.
I would probably solve the weekly bars differently. I would get the price levels with dates, if they are needed, and fill them into a separate array and compare with this array. Or rather, that is how I do it. For each TF my own array of extrema.
I am not making comparisons, I am speaking about arrays
And immediately understand the size of the daily TF array and time it and stay on time.
I would probably solve the weekly ones differently. I would get price levels with dates at weekly ones, if they are needed, and fill them into a separate array and compare with this array. Or rather, that is how I do it. For each TF I have my own array of extrema.
I'm not making comparisons, I'm talking about arrays.
(I would get price levels with dates, if they are needed, and fill them into a separate array and compare them with that array)
We don't know which ones we need and which ones we don't, we need all possible history of all bars.
ArrayCopyRates
Copies data of the specified chart bars into an array and returns the number of copied bars.
intArrayCopyRates(
MqlRates&rates_array[],// array MqlRates passed by the reference
stringsymbol=NULL,// the tool
inttimeframe=0// timeframe
);
where is it not clear ?
I can't figure out the connection
It sees 323 months which is somewhere close to 27 years, 1403 weeks, 7015 days
AUDUSD history since 1993, 2020-1993= 27
(Get price levels with dates, if needed, and put them in a separate array and compare with this array).
We don't know which ones we need and which ones we don't, we need all possible history of all bars.
ArrayCopyRates
Copies data of the specified chart bars into an array and returns the number of copied bars.
intArrayCopyRates(
MqlRates&rates_array[],// array MqlRates passed by the reference
stringsymbol=NULL,// the tool
inttimeframe=0// timeframe
);
where is it not clear ?
I can't figure out the connection
It sees 323 months which is somewhere close to 27 years, 1403 weeks, 7015 days
AUDUSD history since 1993, 2020-1993= 27
No idea in what can be measured or determined. First we measure the range and we know.
If we write down all the extrema in the daily data over 27 years and identify the equal ones, they will be too many. The task is similar to identifying copies on a disc, only simpler.