Help needed, explaining the coding

 
<SNIP>

 

here is what i had written so far, when i tested on strategy tester, no trade was occur, i compiled the code with no error no warnings, can anyone tell me why  ?
also is there anyone to give me suggestion on perfecting it? 

 
Please edit your post . . . 


Please use this to post code . . . it makes it easier to read.

 
shenlongming:


here is what i had written so far, when i tested on strategy tester, no trade was occur, i compiled the code with no error no warnings, can anyone tell me why  ?

also is there anyone to give me suggestion on perfecting it? 

Yes,  x was not equal to 1

This kind of things makes no sense in mql4  . . .

( jaw < teeth < lips )

  . . .  if these variables are doubles then one set will be evaluated to a bool and then you will be comparing a double with a bool . . .

 
RaptorUK:

Yes,  x was not equal to 1

This kind of things makes no sense in mql4  . . .

  . . .  if these variables are doubles then one set will be evaluated to a bool and then you will be comparing a double with a bool . . .

 

 


the jaw, teeth and lips are double, i did not see anything wrong with it, can you explain further?
as my condition is lip(assume value will be 1.111)bigger than teeth(1.110),and jaw (1.109),then the condition is true, and when the condition is true, then int x =1, and allow order send if x==1
nothing wrong with the logic, isn't it?
 
shenlongming:

the jaw, teeth and lips are double, i did not see anything wrong with it, can you explain further?
as my condition is lip(assume value will be 1.111)bigger than teeth(1.110),and jaw (1.109),then the condition is true, and when the condition is true, then int x =1, and allow order send if x==1
nothing wrong with the logic, isn't it?

This gets evaluated to a bool . . . 

( jaw < teeth  )

  . . . then you have this . . .

( bool < lips )

 how does that make sense to you ?

 

actually i still dont get you but thx for the reply
i had know why my code didnt work, it is due to the value didnt get to the jaw,teeth and lip, which is solved.
and then the function jaw<teeth is still in use and both of them are double value, and it work.
supposedly it had nothing to do with bool

 

by anyway, is that possible for you to show me how to limit the total open trade at one time? 

which mean i can only have 2 open trade at any time, and any signal or ordersend will be made unavailable later .

 
shenlongming:

actually i still dont get you but thx for the reply
i had know why my code didnt work, it is due to the value didnt get to the jaw,teeth and lip, which is solved.
and then the function jaw<teeth is still in use and both of them are double value, and it work.
supposedly it had nothing to do with bool

Your code wasn't . . .  

if ( jaw < teeth  )

 it was . . .

if ( jaw < teeth < lips )

 this is not a function,  it's an expression,  an expression is evaluated to a bool,  so it is either true or false.

 Try the attached script,  see if you can explain the results output to the Experts tab/log . . . 

 

//  script written to check if multiple < compares work
double a = 0.3, b = 0.4, c =0.5;

// in theory (a < b < c) would be true

int start()
   {
   if(a < b)  Print("a < b is true");
   else  Print("a < b  is false");
   
   if(b < c)  Print("b < c is true");
   else  Print("b < c is false");
   
   if(a < b < c)  Print("a < b < c is true");
   else  Print("a < b < c is false");
   
   }
Files:
 
RaptorUK:

Your code wasn't . . .  

 it was . . .

 this is not a function,  it's an expression,  an expression is evaluated to a bool,  so it is either true or false.

 Try the attached script,  see if you can explain the results output to the Experts tab/log . . . 

 


i see your meaning now

//alligators signal                                                                      
      {
      if(jaw>teeth && teeth>lips)                                                                     //alligator
         {
         allsignal=2;
         }
      else if(jaw<teeth && teeth<lips)
         {
         allsignal=1;
         }
      else   allsignal=0;
      }

 this is what i write. thx for the advice man.

 
shenlongming:


i see your meaning now

 this is what i write. thx for the advice man.

Well done for trying to follow my point . . you got there in the end :-)
Reason: