Sometimes, you need conditional expressions, which provide different values based on whether a specific condition is met. For example, in EX1:
EX1: RSI1>70 , 10 , 0
If the condition RSI1>70 is true, the expression returns 10; otherwise, it returns 0.
In EX2, if MA1 crosses above MA2, it returns EXP1; otherwise, it returns MA1[5].
EX2: MA1 CROSSUP MA2 , EXP1 , MA1[5]
In EX3, the expression uses a logical “and” between two sets of parentheses. As mentioned above, if the value of this logical expression is true, it returns EXP1; otherwise, it returns EXP2.
EX3: (MA1<MA2) AND (MA3 CROSSDOWN MA4) , EXP1 , EXP2
In EX4, if the signal line of MACD is above the mainline of MACD, the expression returns 1; otherwise, it returns 0.
EX4: MACD1:SIGNAL ISABOVE MACD2:MAIN , 1 , 0
In EX5, if EXP1 (which has been defined elsewhere) is true, the expression returns EXP2; otherwise, it returns EXP3.
EX5: EXP1 , EXP2 , EXP3
Based on these explanations, you can infer the meaning of EX6. You can use such conditions to determine entry points.
EX6: Spread<12Points , 1 , 0
If Wait While
Another type of IF expression is “If Wait While” expressions. By default, the output of this type of IF expression is false. If expression 1 becomes true, the system will wait for expression 2 to become true. Once expression 1 is true, it will continue to wait for expression 2 to be true, ignoring changes to expression 1. When expression 2 becomes true, the output will be true. If expression 1 turns false, or the maximum time or maximum number of candles is reached since expression 1 was true, it will re-evaluate expression 1.
For example:
EX7: MA1 CROSSUP MA2, RSI CROSSUP 30, MA1>MA2, 150, 10
In EX7, ESB waits for MA1 to cross above MA2, and then it waits for RSI to cross above 30. As long as MA1 is greater than MA2, ESB will continue to wait for RSI. If it waits more than 150 seconds or more than 10 candles, it will go back and check if MA1 crosses above MA2 again.