Maxim, it doesn't work that way, there should be 2 cycles, otherwise there is no way. First you remove unnecessary elements, then you "shrink" the array upwards (float). The second loop is inside the first one.
No, his algorithm is correct, just slow. There was a small mistake. corrected and simplified:
int ArrayDeleteVal3(int &arr[],int val)
{
int size=ArraySize(arr);
int count=0; // кол-во удалённыхfor(int i=0;i<size;i++) {
if (arr[i]==val) count++;
else arr[i-count]=arr[i];
}
ArrayResize(arr,size-count);
return size-count;
}
For example, write the fastest code for a simple robot. Or the shortest robot code.
Suggest your options.
Write a robot that sorts history bars by their parameters inside arrays. The values of the parameters of the bars, which are closer to each other, get to one group. The robot should automatically determine the number of groups, create them and sort out the bars indexes by them. For example.
Главным преимуществом торговых терминалов MetaTrader является возможность создания автоматических торговых систем, способных совершать торговые операции без вмешательства трейдера, что позволяет исключить влияние психологии на результаты торговли. Для этого нужно сформулировать торговую стратегию и реализовать ее в виде программы на языке MQL...
Maxim, it doesn't work that way, there should be 2 cycles, otherwise there is no way. First you remove unnecessary elements, then you "shrink" the array upwards (float). The second loop is inside the first one.
No, his algorithm is correct, just slow. There was a small mistake.
corrected and simplified:
Nostalgia?
Boring. There's not enough competition.
Boring. There's not enough competition.
Let's make up a competition.
For example, write the fastest code for a simple robot. Or the shortest robot code.
Suggest your options.
Let's think of a competition.
For example, write the fastest code for a simple robot. Or the shortest robot code.
Suggest your options.
Write a robot that sorts history bars by their parameters inside arrays. The values of the parameters of the bars, which are closer to each other, get to one group. The robot should automatically determine the number of groups, create them and sort out the bars indexes by them. For example.
No, his algorithm is correct, just slow. There was a small mistake.
corrected and simplified:
You have a slow one.
No, it has the right algorithm, it's just slow. There was a small mistake.
I fixed it and simplified it:
I'll let you in on a terrible secret. Array Resize eats up a lot of resources.
I'll let you in on a terrible secret. Array Resize eats up a lot of resources.
if it were in a loop, but it's only executed once.
Drinking again?