How do you count down a a boolean conditions in mql5 - page 2

 
ZhuwaoAbel #:

Thanks you are right . i reassigned a variable to check  handle value  in case its equal or below 0  in this case raise an alert 

// If at least one handle is valid
if(handlerma!=INVALID_HANDLE || handlersi!=INVALID_HANDLE || handleyma!=INVALID_HANDLE)
// If all handles are valid
if(handlerma!=INVALID_HANDLE && handlersi!=INVALID_HANDLE && handleyma!=INVALID_HANDLE)
 
Yashar Seyyedin #:
Your code ignores the first cross and draws a vertical line for the second. again ignores the third and draws a vertical line for the forth cross and so on for 20 candles. 

What is wrong now? What do you expect?

Every time the vertical line is replaced with the same name:"2nd cross over".

Here at my end the code only counts up to 1 and at some points it starts it goes back and forth betwen 0 and 1 and when it reaches the second crossover  its count_D becomes 1 again and the process repeats again and it doesnt the yellow line anymore.I have taken the liberty to read 100 bars and the output points out it must definately be something with the way i loop through candles .Results the EA detected a crossover but jumped back and forth ignoring the second crossover and going to and from the third crossover with the count value  changing from 0 and 1 as shown in the image output.png below

Files:
output.PNG  33 kb
 
drawVerticalLine("2nd cross over"+(string)(i), timex, clrYellow);

You need a separate(unique) name for each vertical line.

 
Yashar Seyyedin #:

You need a separate(unique) name for each vertical line.

thank you ,kkkk i now think the problem is with the loop  let me tweak around that i added the seperate uname and the output is shown in the crossover_error.png

Files:
Reason: