Download MetaTrader 5
To add comments, please log in or register
Trade like successful traders - subscribe to their signals!
whroeder1
13920
whroeder1 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.
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 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

Mo
59
Mo 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 .
Mo
59
Mo 2014.04.27 16:02  
Thx deysmacro, will do more research .
Keith Watford
Moderator
8772
Keith Watford 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) {

buysig=true;

}
Ian Venner
2583
Ian Venner 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)
   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");
  }
//+------------------------------------------------------------------+
SYED NAUFAL GADDAFI
1401
SYED NAUFAL GADDAFI 2014.04.27 19:32  
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.
/ /12
To add comments, please log in or register