First of all, logical expressions only produce true or false results. For example, consider a logical expression like EX1.
EX1: RSI1>70 AND MA1>MA2
The logical value of this expression will be either true or false. You can use this result, for example, to determine whether the expert should enter a position or whether a specific action should be triggered.
Some keywords are supported here, such as “CROSSUP”. For example:
EX2: MA1 CROSSUP MA2
This means that if MA1 crosses MA2 upward, the value of this expression is true; otherwise, it is false.
You can use parentheses to determine priorities in more complex expressions, such as EX3.
EX3: (MA3<MA4 AND RSI1<30) OR (MA1 CROSSDOWN MA2)
Remember that operations inside parentheses have the highest priority and are evaluated first.
If you create an indicator named MACD1 and want to refer to the signal line, you can use a colon character followed by the word “signal”. You can also do the same for the main line, as shown in EX4.
EX4: MACD1:SIGNAL ISABOVE MACD2:MAIN
For mathematical functions, such as absolute value, logarithms, and trigonometric functions, you can use them as needed. For example, consider EX5.
EX5: MathSQRT[MA1-MA2]>15PIPS
Notation: “MathSQRT[MA1-MA2]” measures the distance between MA1 and MA2. Additionally, you can easily use the term “pips”.
There are keywords like “Spread”, “Ask”, and “Bid” which you can use for real-time values such as spread, ask price, or bid price. As illustrated in EX6:
EX6: Spread<12Points AND MA1>Ask
If you have defined an indicator named MA1 and want to refer to its shifted value, you can put a number in brackets to specify the shift. For example, see EX7.
EX7: MA1[1] > MA1[26]
You can also refer to the four parameters of any candle: open, close, high, and low. For example, EX8 demonstrates how to check if the candle from two periods ago was ascending.
EX8: Close[2] > Open[2]
Detecting if the price touches an ABC indicator (in tick-based mode) is shown in EX9.
EX9: Ask>=ABC AND Bid<=ABC