Expression Editor
The expression editor is used to enter a mathematical expression into the value of a Variable.
An example of a simple expression is the sum of two numbers:
Bid + Ask
A more complicated expression may find the average of two numbers:
(Bid + Ask)/2
The MQL language offers many Math functions for forming complex expressions. A very complex expression would probably be easier to implement using an MQL Function, however, the Expression Editor is convenient for simple expressions.
- The Expression Editor text-box can be manually edited.
- The left pane of the Expression Editor lists the available MQL Math functions. To insert a Math function, select it and it will appear in the button below the list; then select the button to add the value to the expression.
- The right pane of the Expression Editor lists the available System Variables. To insert a variable, select it and it will appear in the button below the list; then select the button to add the value to the expression.
- The operators for addition, subtraction, multiplication and division can be added manually or by using the buttons along the top.
- Open and close parenthesis can be added manually or by using the buttons along the top.
- NOTE: Some knowledge of MQL and mathematics is required to use the Expression Editor correctly. Syntax errors can be injected into the trading system if care is not taking when entering expressions.