Isssue with conditional test - page 2

13920
2014.04.27 15:30
zzdream: but why is the second condition also evaluating true? I am still referencing bb_b4
How should we know? You have posted your code where you set those variables? There are no mind readers here.
1401
2014.04.27 16:00

@ zzdream

I think you need to do some more research about using bbands and see how the condition works.

I bet once you realized what is going on, you will be laughing hard. Seriously...

We here already see where are you going though .. XD

59
2014.04.27 16:00
Come on you are totally neglecting the fact that there must AT LEAST one mind rereader among these brilliant minds :) jk.

I gave the values for the variables, chk my posts .
59
2014.04.27 16:02
Thx deysmacro, will do more research .
Moderator
8772
2014.04.27 17:56
zzdream:
ok I understand this make no sense to an experienced 'eye' . I understand 'age is younger than 30 AND my age is older than 30...' is not clear. But doing the below evaluates true:

2 bband settting : bb_b3=20 bb_b4=10

So in essence I am still saying ie 'age is younger than 30 AND my age is older than 30...' for bb_b4. Why is this the case ? The way the code is split? How would you guys split up the code for all 4 conditions to evaluate true ? Sorry for the ignorance... went over the mq4 doc for conditional tests + google search . Not getting this.

We don't know what the value of btrend or buysig before the first condition.

Try this

```btrend=0;  buysig=false;

if (bb_b3>0 && bb_b4<0) {

btrend=1;

}

if (btrend>0 && bb_b4>0) {

}```
2583
2014.04.27 18:26
zzdream:
Come on you are totally neglecting the fact that there must AT LEAST one mind rereader among these brilliant minds :) jk.

I gave the values for the variables, chk my posts .

When you don't understand why something does what it does in MQL4 always, experiment with a script. Like the one below, change the test values, change the conditions and see what happens. You will learn a lot from it.

```//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
{
//---test values

int var1 = 10;
int var2 = 50;

//--test1

if(var1 <100 && var2 <100)

//--test2

if(var1 <100 && var2 <100 && var1 >100)