Isssue with conditional test - page 2

 
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.
 

@ 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

 
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 .
 
Thx deysmacro, will do more research .
 
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) {

buysig=true;

}
 
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)
   Alert("Test1 is true");
   else Alert("Test1 is false");

//--test2

   if(var1 <100 && var2 <100 && var1 >100)
   Alert("Test2 is true");
   else Alert("Test2 is false");
  }
//+------------------------------------------------------------------+
 
SDC:

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.


Yup, standard practice which I usually do and it helps a lot.
Reason: