I executed the following code in the init() of an EA . . .
bool a = true, b = true, c = true; if (a && b && c) Print ("Test Successful!"); else Print ("Test Failed.");
. . . and it produced the following output into the journal/log:
15:17:08 TestingEA EURUSD,H1: loaded successfully
15:17:09 TestingEA EURUSD,H1: Test Successful!
15:17:09 TestingEA EURUSD,H1: initialized
15:17:21 TestingEA EURUSD,H1: deinitialized
15:17:21 TestingEA EURUSD,H1: uninit reason 1
15:17:21 TestingEA EURUSD,H1: removed
Yes. I'm sure they are set to true. Here is the code:
if(NewBar()){ //boolean a Alert("a "); } if(r){ //boolean b Alert("b"); } if(Rcount>=29){ //boolean c Alert("c"); } if(NewBar()&& r && Rcount>=29){ Alert("a b c"); }
when the conditions are satisfied, this is what i receive in the Alert box. The 4th if statement didn't execute.
Today i encountered a problem but i have no idea why it's happen.
But when I erased all three if statements above and replace them with
Can someone please help me?
Hmmm . . . looks to me like the OP is using a Logical AND (&&), rather than a bitwise AND (&).
I had test all 4 seperately, and only the first three works. The combine one doesn't. I also did.
if(r && Rcount>=29){ Alert("b c"); }
This one pops up just fine. So i though it might be gotta do with the NewBar() one.
int count; bool NewBar() //return true when new bar or candle appear on the chart { if (count!=iBarShift(NULL,0,0)) { count=iBarShift(NULL,0,0); return(true); } return(false); }
I had been staring at this one for so long and yet no clue.
I'm sorry. I don't quite get what you mean by hit max bars on chart.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Today i encountered a problem but i have no idea why it's happen.
But when I erased all three if statements above and replace them with
Can someone please help me?