If you don't mind giving me an example, how to write it correctly?
I have some experience in trading, but I'm only starting to learn MQL4.
If you use MqlRates, then declare an array:
MqlRates Bar_data_D1[];
That is, you get a one-dimensional array instead of a two-dimensional one. MqlRates is a standard structure (described in MQL4 Reference under "Basics of the Language" - "Data Types" - "Structures, Classes, Interfaces"). It has all the fields that you need in this case. You can address them like this:
Bar_data_D1[i].high; Максимум свечи
Bar_data_D1[i].low; Минимум свечи
i is the index of the array.
In the same way you can create your own structure to record the parameters of candlesticks. It will be smaller than Mqlrates by two fields (spread and real_volume), which you don't need. The structure will look like this:
struct BarData
{
datetime time; // время начала периода double open; // цена открытия double high; // наивысшая цена за период double low; // наименьшая цена за период double close; // цена закрытия long tick_volume; // тиковый объем
};
Declaring an array of such structures looks like this:
BarData Bar_data_D1[];
Accessing members of the structure is similar to accessing members of MqlRates structure.
Структура исторических данных - Структуры данных - Константы, перечисления и структуры - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
That is, you get a one-dimensional array instead of a two-dimensional one. MqlRates is a standard structure (described in MQL4 Reference under "Language Fundamentals" - "Data Types" - "Structures, Classes, Interfaces"). It has all the fields that you need in this case. You can address them like this:
i is the index of the array.
In the same way you can create your own structure to record the parameters of candlesticks. It will be smaller than Mqlrates by two fields (spread and real_volume), which you don't need. The structure will look like this:
Declaring an array of such structures looks like this:
Access to members of the structure is similar to access to members of MqlRates structure.
Ok, I will try it tomorrow !
Thank you for your help. I will let you know when I figure it out.
over this period
don't get it ?
The nearest minimum in the history is less than Low_1_Level , which will be .
Run the code to see how it works.
I have no errors for the whole period
I'm attaching the log
I have no errors for the whole period
I'm attaching the log.
There seems to be no error but it is in the log
You have in your log 19:31:53.126 2016.12.15 00:00:00 Array EURUSD,H1: i = 456 Bar_data_D1 [i][2] = 1.04789
as I have a price Min_D:104789 more than low_D1 1.03660 , by convention it cannot be so.
if i replace the for loop, there will be an error. and it will be correct.
actually expression2 is just masking an error
There is a question. Why do you start the loop with the first element and not zero?
If you don't mind giving me an example, how to write it correctly?
I have some experience in trading, but I'm only starting to learn MQL4.
If you use MqlRates, then declare an array:
MqlRates Bar_data_D1[];That is, you get a one-dimensional array instead of a two-dimensional one. MqlRates is a standard structure (described in MQL4 Reference under "Basics of the Language" - "Data Types" - "Structures, Classes, Interfaces"). It has all the fields that you need in this case. You can address them like this:
i is the index of the array.
In the same way you can create your own structure to record the parameters of candlesticks. It will be smaller than Mqlrates by two fields (spread and real_volume), which you don't need. The structure will look like this:
Declaring an array of such structures looks like this:
Accessing members of the structure is similar to accessing members of MqlRates structure.
Exactly!
If via MqlRates, you declare the array like this:
That is, you get a one-dimensional array instead of a two-dimensional one. MqlRates is a standard structure (described in MQL4 Reference under "Language Fundamentals" - "Data Types" - "Structures, Classes, Interfaces"). It has all the fields that you need in this case. You can address them like this:
i is the index of the array.
In the same way you can create your own structure to record the parameters of candlesticks. It will be smaller than Mqlrates by two fields (spread and real_volume), which you don't need. The structure will look like this:
Declaring an array of such structures looks like this:
Access to members of the structure is similar to access to members of MqlRates structure.
Ok, I will try it tomorrow !
Thank you for your help. I will let you know when I figure it out.