Hi
I have this code as part of a function in my EA, basically it looks for breakouts of the upper and lower bands from the start time (bar) thats is specified earlier in the in the EA, up to the current bar plus 3.
By defualt the fucntion returns an empty_value unless I break out the bands is detected, I have managed to get this to work.
What I am trying to do is if there is a breakout found, another part of the function looks to see if, after the breakout time to the current bar plus 3 the price has once again gone back between to bands, this is the part that doesnt seem to work well.
Shouldn't you be using Highs and Lows rather than Opens and Closes ? also, does this work ? Close[i]&&Open[i]<bbhi have you tested it ? how can you perform a Logical AND on a double ? i'm not saying it is 100% wrong it just seems that it may well be wrong . . . instead I would do this . . .
Close[i]<bbhi && Open[i]<bbhi
rather than using a loop you can probably use iHighest and iLowest https://docs.mql4.com/series/iHighest & https://docs.mql4.com/series/iLowest
Shouldn't you be using Highs and Lows rather than Opens and Closes ? also, does this work ? Close[i]&&Open[i]<bbhi have you tested it ? how can you perform a Logical AND on a double ? i'm not saying it is 100% wrong it just seems that it may well be wrong . . . instead I would do this . . .
rather than using a loop you can probably use iHighest and iLowest https://docs.mql4.com/series/iHighest & https://docs.mql4.com/series/iLowest
Hi
Thanks for the reply, just tried that and still no joy :(
I am now trying to add some code to draw a vertical line to represent "nlbar", can anyone give nay pointers on the best way to do this as when I try it seems to output wrong or not at all.
Thanks
Antony
Hi
Thanks for the reply, just tried that and still no joy :(
I am now trying to add some code to draw a vertical line to represent "nlbar", can anyone give nay pointers on the best way to do this as when I try it seems to output wrong or not at all.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi
I have this code as part of a function in my EA, basically it looks for breakouts of the upper and lower bands from the start time (bar) thats is specified earlier in the in the EA, up to the current bar plus 3.
By defualt the fucntion returns an empty_value unless I break out the bands is detected, I have managed to get this to work.
What I am trying to do is if there is a breakout found, another part of the function looks to see if, after the breakout time to the current bar plus 3 the price has once again gone back between to bands, this is the part that doesnt seem to work well.
What I find is the last part of code that uses (nlbar) just seems to always return an empty value giving false alarms, can anyone help?
Thanks
Antony