Kogalym писал(а)>> At SL the EA should open an order of the same type and at TP of the opposite type! But for some reason the EA often opens the order of the wrong type!
Who knows if this indicator is suitable for an EA, I found one strategy where it is applied by the author, can it be written in the EA and how to do it, for example, can you show me an example. I have found the histogram is green and if the line is below the histogram, it gives a buy signal. The same for sell.
и не понятно, что именно вы хотите получить в массивах MAX и MIN
Let me explain again :)
There is an array that contains all values of MACD columns.
We need to take from all those values a dozen of values (in order) and look for the maximum value in them, and respectively draw it in the indicator, and so on to the end.
Here is the code once again:
for(i=0; i<50; i=i+10) //общий цикл для всех значений МАКД, шаг 10
{
int k = i;
for(k=i; k<i+10; k++) // цикл внутри десятки значений, шаг 1
{
x10[k] = MACD[k];// массив десяток
}
int IndexMAX = ArrayMaximum(x10); // найден индекс максимального значения внутри десятки int IndexMIN = ArrayMinimum(x10); // --//--
MAX[k] = MACD[IndexMAX]; // Рисуем найденное максимальное значение внутри десятки на k баре
MIN[k] = MACD[IndexMIN];
}
As I see it, it's not drawn because the index of array with tens doesn't coincide with the index of this value in the main array with MAKD values.
In other words, when counter reaches, say, 30 in main loop, then in subcycle will go 30-31-32...39 (let's assume, maximal of them will be 34 value), function Arraymaximum(x10) will find it, but will write in IndexMAX exactly ordinal number in HIS (x10) array, i.e. actually true value will be 34, but it will write some other one (from 0 to 9, because it's an array of tens). I can't figure out what to do...
There is an array that contains all values of MACD columns.
We need to take from all those values a dozen of values (in order) and look for the maximum value in them, and respectively draw it in the indicator, and so on to the end.
Here is the code once again:
As I see it, it's not drawn because the index of array with tens doesn't coincide with the index of this value in the main array with MAKD values.
In other words, when counter reaches, say, 30 in main loop, then in subcycle will go 30-31-32...39 (let's assume, maximal of them will be 34 value), function Arraymaximum(x10) will find it, but will write in IndexMAX exactly ordinal number in HIS (x10) array, i.e. actually true value will be 34, but it will write some other one (from 0 to 9, because it's an array of tens). I can't figure out what to do...
for(i=0; i<limit; i+=10) //общий цикл для всех значений МАКД, шаг 10
{
int k;
for(k=0; k<10; k++) // цикл внутри десятки значений, шаг 1
{
x10[k] = MACD[i+k];// массив десяток
}
int IndexMAX = ArrayMaximum(x10); // найден индекс максимального значения внутри десятки int IndexMIN = ArrayMinimum(x10); // --//--
MAX[k] = x10[IndexMAX]; // Рисуем найденное максимальное значение внутри десятки на k баре
MIN[k] = x10[IndexMIN];
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
But for some reason the EA often opens an order of the wrong type!
Please, tell me where there is a mistake!
At SL the EA should open an order of the same type and at TP of the opposite type!
But for some reason the EA often opens the order of the wrong type!
Can you tell me where the mistake is?
и не понятно, что именно вы хотите получить в массивах MAX и MINкакова размерность массива x10 ?
10?
Тогда надо так переписать:
Let me explain again :)
There is an array that contains all values of MACD columns.
We need to take from all those values a dozen of values (in order) and look for the maximum value in them, and respectively draw it in the indicator, and so on to the end.
Here is the code once again:
As I see it, it's not drawn because the index of array with tens doesn't coincide with the index of this value in the main array with MAKD values.
In other words, when counter reaches, say, 30 in main loop, then in subcycle will go 30-31-32...39 (let's assume, maximal of them will be 34 value), function Arraymaximum(x10) will find it, but will write in IndexMAX exactly ordinal number in HIS (x10) array, i.e. actually true value will be 34, but it will write some other one (from 0 to 9, because it's an array of tens). I can't figure out what to do...
Let me explain again :)
There is an array that contains all values of MACD columns.
We need to take from all those values a dozen of values (in order) and look for the maximum value in them, and respectively draw it in the indicator, and so on to the end.
Here is the code once again:
As I see it, it's not drawn because the index of array with tens doesn't coincide with the index of this value in the main array with MAKD values.
In other words, when counter reaches, say, 30 in main loop, then in subcycle will go 30-31-32...39 (let's assume, maximal of them will be 34 value), function Arraymaximum(x10) will find it, but will write in IndexMAX exactly ordinal number in HIS (x10) array, i.e. actually true value will be 34, but it will write some other one (from 0 to 9, because it's an array of tens). I can't figure out what to do...
Show all the code for the indicator
Весь код индикатора покажиLet me explain again :)
I think you meant to write like this:
What's your goal?
Well, what do you want to get. Breaking it down into tens is pointless. They move around in time all the time.
мне кажется, Вы хотели написать вот так:
Doesn't draw :((.
s.w. k=0 I finished it :)
А какую цель преследуешь?
Ну, что хочешь получить. Разбивать на десятки бесмысленно. Они все время передвигаются во времени.
Yes the aim is literal...I want the maximum to be displayed amongst every 10 bars...