This line can be removed, because iFractals() returns zero as no fractal, not "empty value" (EMPTY_VALUE).
My question is as follows: are you trying to make an indicator that will look for two consecutive fractals? Or are you searching in your EA for two consecutive fractals closest to the current bar? This question is not of idle curiosity because the search methods in the indicator and in the Expert Advisor are different - the indicator calculates from the end to the beginning - from past to present, and the Expert Advisor looks through the bars from present to past. Accordingly, the search directions are also different in the Expert Advisor and in the indicator.
And one last question: what should the output be?
Not interested (no need to know until now) in what iFractals() returns. If it's really 0 - yes, sorry I lied, EMPTY_VALUE doesn't need to be checked.
I came up with this formulation as a nice justification - we considered the general case of EMPTY_VALUE and not the local one with 0 return.
But I'm ashamed and am amused myself that I did not know such an elementary thing.
I understand the code was for an indicator - artmedia70 is right that the approach is different for Expert Advisors.
I have no time for it - I will do it at night when I get home, because we have not understood each other well ( after finding the condition of two fractals the event should be processed) but everything is OK.
//----
БЛОК ПРОВЕРКИ НОВОГО БАРА; //проверить наличие нового бара int a1=0, //преведущий фрактал (-1 ->нижний, 1 -> верхний)
a2, //нынешний фрактал (-1 ->нижний, 1 -> верхний)
a3, //сума преведущий + нынешний
kilkict, //была введена с мыслю уменьшить перерасчет после глобального расчета (идея просто еще не реализована)
frac, //frac - флаг существования фракталов,
frac1=0, //frac1- счетчик фракталов (+1 или 0 за цикл)сейчас просто выполняет роль фильтра, надо найти сперва 2 фрактала чтобы приступить к их сравнению.
i;
kilkict=Bars;
for (i=3; i<kilkict;i++){ // 3
a2=0;
frac=0;
if(iFractals(NULL, 0, MODE_UPPER, i)>0) {
if (Bufer0!=EMPTY_VALUE) { //не нужно для iFrctals()данной проверки условий
a2+=1; //к числу фракталов добавляем 1
frac=1; //флаг - фрактал есть
frac1++; //счетчик увеличиваем на 1
}
}
if(iFractals(NULL, 0, MODE_LOWER, i)>0) {
if (Bufer0!=EMPTY_VALUE) { //не нужно для iFrctals() данной проверки условийif(a2==0){
frac1++; //счетчик увеличиваем на 1
frac=1; //флаг - фрактал есть
}
a2+=-1; //к числу фракталов добавляем -1(т. е. уменшаем)
}
}
if (frac==0){continue;} // если флага нет (фрактал не найден)if (frac1==1){ //если счетчик равен 1,
a1=a2;
continue;
}
a3=a1+a2;
if(a3<0) { a1=a2; БЛОК ОБРАБОТКИ УСЛОВИЯ ДВА ФРАКТАЛА НАЙДЕНО; continue;}//Два фрактала вниз подряд найдено// if(a3>0) { a1=a2; БЛОК ОБРАБОТКИ УСЛОВИЯ ДВА ФРАКТАЛА НАЙДЕНО; continue;}//Два фрактала вверх подряд найдено //if(a3==0 && a1==0) { a1=a2; БЛОК ОБРАБОТКИ УСЛОВИЯ ДВА ФРАКТАЛА НАЙДЕНО; БЛОК ОБРАБОТКИ УСЛОВИЯ ДВА ФРАКТАЛА НАЙДЕНО; }// Два фрактала подряд вверх и два фрактала подряд вниз найдено //
}
While the indicator, and then we'll see. The search methods in the indicator and in the Expert Advisor are different - the indicator calculates from end to beginning - from past to present, and the Expert Advisor looks through the bars from present to past .
for (i=kilkict;i>0;i--)
Result - two high -> sell (arrow down), two low -> buy (arrow up). The signal will appear +2 bars to the right of the fractal. That is what I would like to see visually on the history at the beginning. And probably we will need a filter.
Then the question is: why do you want to make yourself tired of writing this indicator, if you just want to look at the history? You were given a link to the Articulus indicator. It does exactly what you want:
Then the question is: why are you torturing yourself by writing this indicator if you just want to look at the stories? You were given a link to the Articulus indicator. It does exactly what you want it to do:
Compile it and look at the history. And then draw conclusions.
Every function there returns a result which is understandable at a glance. I don't get bogged down at a glance. It's as clear as day. Besides, what does he need? He needs to look at stories, not code.
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.
This line can be removed, because iFractals() returns zero as no fractal, not "empty value" (EMPTY_VALUE).
My question is as follows: are you trying to make an indicator that will look for two consecutive fractals? Or are you searching in your EA for two consecutive fractals closest to the current bar? This question is not of idle curiosity because the search methods in the indicator and in the Expert Advisor are different - the indicator calculates from the end to the beginning - from past to present, and the Expert Advisor looks through the bars from present to past. Accordingly, the search directions are also different in the Expert Advisor and in the indicator.
And one last question: what should the output be?
Not interested (no need to know until now) in what iFractals() returns. If it's really 0 - yes, sorry I lied, EMPTY_VALUE doesn't need to be checked.
I came up with this formulation as a nice justification - we considered the general case of EMPTY_VALUE and not the local one with 0 return.
But I'm ashamed and am amused myself that I did not know such an elementary thing.
I understand the code was for an indicator - artmedia70 is right that the approach is different for Expert Advisors.
I have no time for it - I will do it at night when I get home, because we have not understood each other well ( after finding the condition of two fractals the event should be processed) but everything is OK.
...
I apologise for the mistakes. Don't be too hard on me.
Just wondering, it's a funny phenomenon.
Just wondering, it's a funny phenomenon.
Thanks for the correction.
Who does that?
Why bother with a lot of { }?? and slow down the process...
alternatively...
if(SL) dollarsPerPip = lot/SL;While the indicator, and then we'll see. The search methods in the indicator and in the Expert Advisor are different - the indicator calculates from end to beginning - from past to present, and the Expert Advisor looks through the bars from present to past .
for (i=kilkict;i>0;i--)
Result - two high -> sell (arrow down), two low -> buy (arrow up). The signal will appear +2 bars to the right of the fractal. That is what I would like to see visually on the history at the beginning. And probably we will need a filter.
Then the question is: why do you want to make yourself tired of writing this indicator, if you just want to look at the history? You were given a link to the Articulus indicator. It does exactly what you want:
Compile and look at the stories. Then draw conclusions.
Or is "standing in a hammock" more comfortable?
Then the question is: why are you torturing yourself by writing this indicator if you just want to look at the stories? You were given a link to the Articulus indicator. It does exactly what you want it to do:
Compile it and look at the history. And then draw conclusions.
Or is "standing in a hammock" more comfortable?
and you trace the logic of the turkey ))
You don't need 20 functions to figure it out, do you?
Who does that?
Why bother with a lot of { }?? and slow down the process...
alternatively...
Funny, I didn't know that, I'll have to check it out.
and you trace the logic of the turkey ))
you don't get bored with 20 functions???
Who does that?
Why bother with a lot of { }?? and slow down the process...
that's one way to do it.
Thanks for the correction.
I have this stupid habit
when writing a conditional statement
to put parentheses right away.
Can you tell me how to determine the price for a text marker so that it is always at the top of the chart?
We draw a vertical line at a given time and we want its name at the top.