The conditional operator if-then-else also known as the if-expression is applied to three values. The first operand is interpreted as a logical statement. If the statement is true, then the result of the operator equals the second operand, otherwise - the third.


input price = close;
input long_average = yes;

plot SimpleAvg = Average(price, if long_average then 26 else 12);

The value passed to the averaging function is defined depending on the long_average parameter.