Operators
An operator compares or combines the left-hand and right-hand side of a condition. The signal editor has the well known comparison and math operators, plus special crossover operators to make things easier.
In short:
- Crossover operators are true at the moment one value crosses the other.
- Comparison operators are true as long as the left value is above, below or equal to the right value.
- Mathematical operators calculate a value inside an Advanced Condition.
The examples below use two moving averages: MA 7 (fast) and MA 30 (slow).
Crossover operators
Section titled “Crossover operators”A crossover operator is true at the moment the left value crosses the right value, on that bar only. The diagram shows both directions: (1) MA 7 crosses MA 30 from below, (2) MA 7 crosses MA 30 from above.
Use this operator if the direction of the crossover does not matter: it is true at an Up Cross and at a Down Cross, moments (1) and (2) in the diagram.
Example: MA 7 | S1 Cross MA 30 | S1: MA 7 crosses MA 30, from below or from above.
Up Cross
Section titled “Up Cross”Use this operator if the left value must cross the right value from below: moment (1) in the diagram.
Example: MA 7 | S1 Up Cross MA 30 | S1: MA 7 was below MA 30 on the bar before, and is now above or equal.
Down Cross
Section titled “Down Cross”Use this operator if the left value must cross the right value from above: moment (2) in the diagram.
Example: MA 7 | S1 Down Cross MA 30 | S1: MA 7 was above MA 30 on the bar before, and is now below or equal.
Comparison operators
Section titled “Comparison operators”A comparison operator is true as long as the left value is above, below or equal to the right value: on every bar, not only at the moment of a cross.
Comparison operator. Condition is met if both sides of the condition are equal.
Example: MA 7 | S1 Equal MA 30 | S1: the value of MA 7 is equal to the value of MA 30.
Prices and indicator values rarely are exactly equal. Equal is most useful with whole numbers, such as Hour Equal
9 or an arrow indicator Not Equal EMPTY.
Not Equal
Section titled “Not Equal”Comparison operator. Condition is met if both sides of the condition are not equal.
Example: MA 7 | S1 Not Equal MA 30 | S1: the value of MA 7 is not equal to the value of MA 30.
Above Or Equal
Section titled “Above Or Equal”Comparison operator. Condition is met if the left side of the condition is above or equal to the right side.
Example: MA 7 | S1 Above Or Equal MA 30 | S1: the value of MA 7 is above or equal to the value of MA 30.
Below Or Equal
Section titled “Below Or Equal”Comparison operator. Condition is met if the left side of the condition is below or equal to the right side.
Example: MA 7 | S1 Below Or Equal MA 30 | S1: the value of MA 7 is below or equal to the value of MA 30.
Comparison operator. Condition is met if the left side of the condition is above the right side.
Example: MA 7 | S1 Above MA 30 | S1: the value of MA 7 is above the value of MA 30.
Comparison operator. Condition is met if the left side of the condition is below the right side.
Example: MA 7 | S1 Below MA 30 | S1: the value of MA 7 is below the value of MA 30.
Mathematical operators
Section titled “Mathematical operators”A mathematical operator calculates a value from two values. You use them in an Advanced Condition (in an Operation or a Math Operator) and in the At price of a pending order.
Use this operator to add numbers, in an Advanced Condition.
Example: MA 7 | S1 Above MA 30 | S1 + 100: MA 7 is above MA 30 plus 100.
Subtract
Section titled “Subtract”Use this operator to subtract numbers.
Example: MA 7 | S1 Above MA 30 | S1 − 100: MA 7 is above MA 30 minus 100.
Divide
Section titled “Divide”Use this operator to divide numbers.
Example: MA 30 | S1 ÷ 0.75 Above MA 7 | S1: MA 30 divided by 0.75 is above MA 7.
Multiply
Section titled “Multiply”Use this operator to multiply numbers.
Example: MA 30 | S1 × 0.75 Above MA 7 | S1: MA 30 multiplied by 0.75 is above MA 7.
Modulo
Section titled “Modulo”Returns the remainder after a division.
Example: MA 30 | S1 % 2 Equal 0: the remainder of MA 30 divided by 2 is 0.
Related
Section titled “Related”- Trading Signals: conditions, groups and Advanced Conditions
- Functions: values such as Ask, Bid and Hour
- Shift (Bar): which bar a value comes from
MetaTrader is a registered trademark of MetaQuotes Ltd. EA Builder Pro is not affiliated with MetaQuotes.