the simplest way I know of is to write a series of 1 and 0 for the condition(s):
Code:
def condition_1 = if close > sma then 1 else 0;
def condition_2 = if close > ema then 1 else 0;
def condition_1_2 = if ( condition_1 == 0 OR condition_2 == 0 ) then 0 else 1;
def condition_3 = if sum(condition_1_2, n) == 0 then 1 else 0;
Condition_3 is true (1) if for all the bars in n bars, either condition_1 or condition_2 has been false (0) for each bar.
Be sure to adjust your if then else statements to put your actual conditions in place. I just used SMA and EMA as placeholders. THIS CODE WILL NOT RUN without defining them.
-mashume