# Follow the specific value if the condition meet

Hi
When u see the below picture, if the Condition1 equals to "1" and Condition3 equals to "1", I want to make that the other values which have Condition == 1 also change the Condition 3 value "0" to "1".

Please consider below picture and let me know how to do.

Thank you Hi @Harry1

You need to use `iif()` function
https://www.amibroker.com/guide/afl/iif.html

Below some examples
https://forum.amibroker.com/tag/iif

1 Like

I don't know what you have in mind with `Iif` function but you do not need `Iif` .
AFAIU his post1 `Condition1` and `Condition3` both have to be `TRUE` at same bar before new condition becomes `TRUE` and when `Condition1` is consecutively `TRUE` after initial event (-> `Condition1` and `Condition3` being `TRUE`).

``````x = 0;
x = 1;
x = 1;
x = 1;
x = 1;
x = 0;
x = 0;

y = 0;
y = 1;
y = 0;
y = 0;
y = 0;
y = 0;
y = 0;

condition1 = x;
condition3 = y;
combined_cond = condition1 AND condition3;

cond = combined_cond OR condition1 AND Sum(condition1, bars) == bars;

Filter = BarIndex() < 7;

`````` Or if you do not want to include initial event into new condition

``````x = 0;
x = 1;
x = 1;
x = 1;
x = 1;
x = 0;
x = 0;

y = 0;
y = 1;
y = 0;
y = 0;
y = 0;
y = 0;
y = 0;

condition1 = x;
condition3 = y;
//combined_cond = condition1 AND condition3;

cond = /*combined_cond OR*/ condition1 AND Sum(condition1, bars) == bars;

Filter = BarIndex() < 7;

`````` 1 Like

Actually upper one can be written shorter by simply adding `+1` to BarsSince(). ``````// ....

condition1 = x;
condition3 = y; 