The daily extrema, and what you are finding are essentially extrema, lows (or highs) have quite long distances from the current price. The difference between the low and the high on the 132 days on the eve is more than 12300 pips. Price from the nearest low of 2000, from the high of 800.
When using the second form of call, data is actually copied into array dest_array[][], the array itself is automatically reallocated to match the timeframe size (even if the array has been declared static).
The first dimension of the array contains the number of bars. The second dimension has 6 elements with the values:
0 - time (time), 1 - open price (open), 2 - lowest price (low), 3 - highest price (high), 4 - close price (close),
Если некоторое имя, которое не было описано ранее, появляется в выражении и за ним следует левая круглая скобка, то оно по контексту считается именем некоторой функции. Аргументы (формальные параметры) передаются по значению, т. е. каждое выражение x1, . . . , xn вычисляется и значение передается функции. Порядок вычисления выражений и порядок...
When using the second form of call, data is actually copied into array dest_array[][], the array itself is automatically reallocated to match the timeframe size (even if the array has been declared static).
The first dimension of the array contains the number of bars. The second dimension has 6 elements with the values:
0 - time (time), 1 - open price (open), 2 - lowest price (low), 3 - highest price (high), 4 - close price (close),
And where is the returned value of the int-type saved? You passed all the data to the function, but didn't get anything from it.
#property version"1.00"#property strict//символ и таймфрейм текущего графикаstring symbol;
ENUM_TIMEFRAMES frame;
datetime time;
struct BarData
{
struct Elem
{
int number; //порядковый номер периода (дня, месяца или года)double high; //максимум периодаdouble low; //минимум периодаdatetime time_high; //время максимумаdatetime time_low; //время минимума
} Arr[]; //массив периодаint index; //текущий индекс массиваdouble max; //последнее максимальное значение периодаdouble min; //последнее минимальное значение периодаdatetime time_max; //время максимумаdatetime time_min; //время минимума//при создании структуры указываем, что массив пустой
BarData(){index=-1;}
//функция записывает текущие экстремумыvoid WriteBar(int eNumber, string eSymbol, ENUM_TIMEFRAMES eFrame, datetime eTime)
{
int eShift=iBarShift(eSymbol,eFrame,eTime);
double eHigh=iHigh(eSymbol,eFrame,eShift);
double eLow=iLow(eSymbol,eFrame,eShift);
//если элементов ещё нет или период сменилсяif(index<0 || eNumber!=Arr[index].number)
{
ArrayResize(Arr,++index+1);
Arr[index].number=eNumber;
Arr[index].high=eHigh;
Arr[index].low=eLow;
Arr[index].time_high=eTime;
Arr[index].time_low=eTime;
}
//если произошло обновление текущего максимумаif(eHigh-Arr[index].high>0)
{
Arr[index].high=eHigh;
Arr[index].time_high=eTime;
}
//если произошло обновление текущего минимумаif(Arr[index].low-eLow>0)
{
Arr[index].low=eLow;
Arr[index].time_low=eTime;
}
//если произошло обновление предыдущего максимумаif(eHigh-max>0)
{
for(int i=index+1; i>=0; i--)
{
if(Arr[index].high-eHigh>0)
{
max=Arr[index].high;
time_max=Arr[index].time_high;
break;
}
}
}
//если произошло обновление предыдущего минимумаif(min-eLow>0)
{
for(int i=index+1; i>=0; i--)
{
if(eLow-Arr[index].low>0)
{
min=Arr[index].low;
time_min=Arr[index].time_low;
break;
}
}
}
}
} day, month, year;
intOnInit()
{
symbol=Symbol();
frame=(ENUM_TIMEFRAMES)Period();
return(INIT_SUCCEEDED);
}
voidOnTick()
{
//текущее время закрытого бара
time=iTime(symbol,frame,1);
MqlDateTime date;
TimeToStruct(time,date);
//делаем записи каждого периода
day.WriteBar(date.day,symbol,frame,time);
month.WriteBar(date.mon,symbol,frame,time);
year.WriteBar(date.year,symbol,frame,time);
//теперь имеем значения Comment(TimeToString(day.time_max)+" : "+DoubleToString(day.max)+" : "+DoubleToString(day.Arr[day.index].high)+"\n"+TimeToString(day.time_min)+" : "+DoubleToString(day.Arr[day.index].low)+" : "+DoubleToString(day.min));
}
We should try to avoid unnecessary cycles. We have a lot of quotes coming in, and you need to make the right entries on the fly, so that you don't have to dig through history and waste computer resources.
Yes, you do not understand something. It should go like this:
Количество_баров=ArrayCopyRates(Bar_data_D1,_Symbol,PERIOD_D1); // Копирует в массив данные баров указанного графика и возвращает количество скопированных баров
The daily extrema, and what you are finding are essentially extrema, lows (or highs) have quite long distances from the current price. The difference between the low and the high on the 132 days on the eve is more than 12300 pips. Price from the nearest low of 2000, from the high of 800.
I don't get it either.
Sorry, I will try to explain tomorrow tired today
AUDUSD is not like that for me
What does it copy and return to where?
What is being copied where and to whom?
What does it copy to and return to?
intArrayCopyRates(
MqlRates&rates_array[],// array of MqlRates passed by reference
stringsymbol=NULL,// the tool
inttimeframe=0// timeframe
);
Copies data of the specified chart bars into a two-dimensional array of the form double RateInfo[][6] and returns the number of copied bars.
intArrayCopyRates(
void&dest_array[][],// array passed by reference
stringsymbol=NULL,// tool
inttimeframe=0// timeframe
);
Parameters
ArrayCopyRatesWhen using the second form of call, data is actually copied into array dest_array[][], the array itself is automatically reallocated to match the timeframe size (even if the array has been declared static).
The first dimension of the array contains the number of bars. The second dimension has 6 elements with the values:
0 - time (time),
1 - open price (open),
2 - lowest price (low),
3 - highest price (high),
4 - close price (close),
intArrayCopyRates(
MqlRates&rates_array[],// array of MqlRates passed by reference
stringsymbol=NULL,// the tool
inttimeframe=0// timeframe
);
Copies data of the specified chart bars into a two-dimensional array of the form double RateInfo[][6] and returns the number of copied bars.
intArrayCopyRates(
void&dest_array[][],// array passed by reference
stringsymbol=NULL,// tool
inttimeframe=0// timeframe
);
Parameters
ArrayCopyRatesWhen using the second form of call, data is actually copied into array dest_array[][], the array itself is automatically reallocated to match the timeframe size (even if the array has been declared static).
The first dimension of the array contains the number of bars. The second dimension has 6 elements with the values:
0 - time (time),
1 - open price (open),
2 - lowest price (low),
3 - highest price (high),
4 - close price (close),
And where is the returned value of the int-type saved? You passed all the data to the function, but didn't get anything from it.
Where is the return value of int type saved? You passed all the data into the function, but didn't get anything out of it.
Min_D_Level = iLow(_Symbol,PERIOD_D1,i); break;It seems to be stored here
double Min_D_Level ; //nearest Minimal D-level
or I do not understand something ?
And where is the returned value of int type saved?
???
I am really brainstorming.
Is it possible to do it in a simpler way?
Like you (you) made a mistake here, the right way to do it is this code example, etc.
Been sitting here for a while:
We should try to avoid unnecessary cycles. We have a lot of quotes coming in, and you need to make the right entries on the fly, so that you don't have to dig through history and waste computer resources.Sort of like this
double Min_D_Level ; //nearest min D level
Or am I missing something ?
Yes, you do not understand something. It should go like this:
And then...
Yes, there's something you don't understand. That's the way it has to be:
And then...
Thank you very much!
Thank you very much on that one too !!!
You're very welcome.
3.47 I'm going to bed.
I'll digest it all tomorrow and if I have any questions I'll let you know !
Thanks a lot everyone !!!