boolean trade condition...

 

I am trying to use a boolean statement within my signal paramenters - 

in global variables I have 'USE MA' = True,

I need to insert nested if statement, but it keeps running with errors.. 

In other words I want to add another condition if (and only if) boolean statement on global level is true, otherwise just continue without..

  if ((condition 1) && (condition 2) &&
         
       (if (MA_Filter==True) FastMA=<SlowMA) 

     {
      do this
     }
 
   if((condition 1) && (condition 2) && (!MA_Filter || (MA_Filter && FastMA<=SlowMA))) 
     {
      do this
     }
It should be <= not =<
 
honest_knave:
It should be <= not =<

Thanks but that did not solve the issue..
 
fabian waldo:

Thanks but that did not solve the issue..

Did you look at the rest of the code I posted? You need to do that, or you could use a ternary operator.
 
fabian waldo: In other words I want to add another condition if (and only if) boolean statement on global level is true, otherwise just continue without..
fabian waldo: Thanks but that did not solve the issue..
  1. honest_knave's answer exactly answered your question. Simplified:
    if((condition 1)                   // Condition1
    && (condition 2)                   // and condition2
    && (!MA_Filter || FastMA<=SlowMA)  // and (if filter enabled) condition3
    ) {
       do this
    }

  2. What issue? "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
 
honest_knave:

Did you look at the rest of the code I posted? You need to do that, or you could use a ternary operator.


For some reason I missed that... 

It works now, Thanks a lot for the help knave!

Reason: