Operator
Arithmetic, comparison and boolean operators, with exact versions for big numbers: bi+ and the other bi operators work on integers of any size, bd+ and the other bd operators on decimals without rounding error. Typical uses: compute amounts that must be exact, test conditions in an if.
+-*/bi+bi-bi*bi/bd+bd-bd*bd/andorxornotis nullis not nullis null or emptyis emptyis not emptyequalnot equal==!=>>=<<=

+ <number1> <number2>


Description

    addition

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
+ 23 42
mentdb
65
Used in use cases (207 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    MQL developer › Cache a slow result in a node with a TTL
    Backend & web service developer › Publish a typed web service with its parameter and stack options
    Date & time developer › French public holidays and a delivery date in working days
    String & encoding developer › Clean a customer line before import
    Data validation developer › French company VAT number and social security key
    and 201 more in the Use cases
Often used with

    json doc  ·  string regexp_replace  ·  json iarray  ·  json parse_array  ·  string trim  ·  math sqrt  ·  atom get  ·  and

- <number1> <number2>


Description

    subtraction

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
- 50 26
mentdb
24
Used in use cases (183 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    MQL developer › User rights as a bitmask
    Backend & web service developer › Health check endpoint for the load balancer
    Date & time developer › Run log header and execution timer
    String & encoding developer › SQL table and API names from form labels
    Data validation developer › Supplier onboarding validation report
    and 177 more in the Use cases
Often used with

    json doc  ·  json iarray  ·  math sqrt  ·  math power  ·  atom get  ·  and  ·  json parse_array  ·  math exp

* <number1> <number2>


Description

    multiplication

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
* 2 5
mentdb
10
Used in use cases (236 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    MQL developer › Cache a slow result in a node with a TTL
    Backend & web service developer › Publish a typed web service with its parameter and stack options
    Date & time developer › Monthly billing dates and proration of an upgrade
    String & encoding developer › Mail merge: fill a template from JSON data
    Data validation developer › French company VAT number and social security key
    and 230 more in the Use cases
Often used with

    json doc  ·  math sqrt  ·  json iarray  ·  math power  ·  string regexp_replace  ·  json parse_array  ·  stat mean  ·  and

/ <number1> <number2>


Description

    division

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
/ 30 2
mentdb
15
Used in use cases (199 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    MQL developer › Catalogue of math and physics constants with eval
    Backend & web service developer › Publish a typed web service with its parameter and stack options
    Date & time developer › Run log header and execution timer
    String & encoding developer › Write and read a fixed width bank transfer file
    Data validation developer › A shared catalogue of data quality rules
    and 193 more in the Use cases
Often used with

    math sqrt  ·  json doc  ·  json iarray  ·  math power  ·  stat mean  ·  json parse_array  ·  math exp  ·  math log

bi+ <number1> <number2>


Description

    Sum of integers of any size (BigInteger), with any number of operands; null if a value is not an integer

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
bi+ 23 42
mentdb
65
admin
bi+ 9223372036854775807 1 1
mentdb
9223372036854775809
Used in use cases (2 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    Algorithms in MQL › Fibonacci with a memo stored in a node
Often used with

    and  ·  bd*  ·  bd+  ·  bd-  ·  bd/  ·  bi*  ·  bi-  ·  bi/

bi- <number1> <number2>


Description

    Difference of two integers of any size (BigInteger)

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
bi- 50 26
mentdb
24
admin
bi- 1 100000000000000000000000
mentdb
-99999999999999999999999
Used in use cases (2 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    Data validation developer › French company VAT number and social security key
Often used with

    bd*  ·  bd+  ·  bd-  ·  bd/  ·  bi*  ·  bi+  ·  bi/  ·  math mod

bi* <number1> <number2>


Description

    Product of two integers of any size (BigInteger), exact

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
bi* 2 5
mentdb
10
admin
bi* 123456789012345678901234567890 987654321987654321
mentdb
121932631246761163237311385323609205901126352690
Used in use cases (3 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    Algorithms in MQL › Recursion: a script that calls itself
    Algorithms in MQL › Euclid's GCD, fractions and exact decimals
Often used with

    bd+  ·  bi/  ·  arith factorial  ·  arith gcd  ·  arith irem  ·  arith lcm  ·  arith to_fraction  ·  bd*

bi/ <number1> <number2>


Description

    Integer division of two integers of any size: the quotient truncated toward zero (null if the divisor is 0)

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
bi/ 30 2
mentdb
15
admin
bi/ 100000000000000000000000000 3
mentdb
33333333333333333333333333
Used in use cases (2 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    Algorithms in MQL › Euclid's GCD, fractions and exact decimals
Often used with

    bd+  ·  bi*  ·  arith gcd  ·  arith irem  ·  arith lcm  ·  arith to_fraction  ·  bd*  ·  bd-

bd+ <number1> <number2>


Description

    Sum of decimal numbers without binary rounding error (BigDecimal), with any number of operands: 0.1 + 0.2 = 0.3 exactly (+ gives 0.30000000000000004)

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
bd+ 23 42
mentdb
65
admin
bd+ 0.1 0.2
mentdb
0.3
Used in use cases (15 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    Data validation developer › Cross-field rules of a hotel booking
    Debugging & error handling › Time a web service with date current_ms
    SQL developer in MQL › Read a large result set by blocks
    Algorithms in MQL › Euclid's GCD, fractions and exact decimals
    Control flow › Quote a B2B order: if, else-if chain and if force
    and 9 more in the Use cases
Often used with

    bd*  ·  bd-  ·  bigdec div  ·  bigdec round  ·  atom get  ·  cm get  ·  date nb_day  ·  json doc

bd- <number1> <number2>


Description

    Difference of two decimal numbers without rounding error (BigDecimal)

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
bd- 50 26
mentdb
24
admin
bd- 1 0.9
mentdb
0.1
Used in use cases (5 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    Control flow › Quote a B2B order: if, else-if chain and if force
    Accountant & manager › Bank reconciliation of account 512
    Security engineer › Subnet of a CIDR block and firewall check
    MQL beginner › Split a bill: functions inside functions
Often used with

    bd*  ·  bd+  ·  bd/  ·  atom get  ·  bi*  ·  bi+  ·  bi-  ·  bi/

bd* <number1> <number2>


Description

    Product of two decimal numbers without rounding error (BigDecimal)

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
bd* 2 5
mentdb
10
admin
bd* 1.1 1.1
mentdb
1.21
Used in use cases (22 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    Versioning & deployment › First commit of a group of scripts
    Debugging & error handling › Time a web service with date current_ms
    SQL developer in MQL › Query to JSON, then enrich the document
    Control flow › Quote a B2B order: if, else-if chain and if force
    Accountant & manager › Late payment interest and recovery indemnity
    and 16 more in the Use cases
Often used with

    bd+  ·  file delete  ·  script create  ·  script delete  ·  type is_double  ·  group add  ·  group grant script  ·  group remove

bd/ <number1> <number2>


Description

    Division of two decimal numbers (BigDecimal): exact when the quotient is finite, else 34 significant digits (null if the divisor is 0)

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
bd/ 30 2
mentdb
15
admin
bd/ 1 3
mentdb
0.3333333333333333333333333333333333
Used in use cases (2 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    Control flow › Quote a B2B order: if, else-if chain and if force
Often used with

    bd*  ·  bd+  ·  bd-  ·  bi*  ·  bi+  ·  bi-  ·  bi/  ·  if force

and <boolean1> <boolean2>


Description

    boolean and

Parameters

    boolean1:   The boolean 1 - boolean - required
    boolean2:   The boolean 2 - boolean - required
admin
and 1 1
mentdb
1
Used in use cases (65 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    MQL developer › Cache a slow result in a node with a TTL
    Backend & web service developer › Inspect a script and answer with a JSON object
    Date & time developer › Is the shop open now, and when does it open next
    Data validation developer › Validate an IoT device registration
    Script developer › Back up a script before deleting it
    and 59 more in the Use cases
Often used with

    while  ·  script create  ·  script delete  ·  wait  ·  date now  ·  atom get  ·  not  ·  sequence add

or <boolean1> <boolean2>


Description

    boolean or

Parameters

    boolean1:   The boolean 1 - boolean - required
    boolean2:   The boolean 2 - boolean - required
admin
or 1 0
mentdb
1
Used in use cases (22 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    Data validation developer › Validate an API payload against its contract
    Script developer › Read a script back to build a form
    Web service developer › GET: one order, 404, or the list
    The MQL language in depth › Booleans and feature flags typed by hand
    Screen & UI developer (sajax) › Approve button: refresh, alert and JavaScript from one action
    and 16 more in the Use cases
Often used with

    json doc  ·  not  ·  atom get  ·  string regexp_extract  ·  atom size  ·  is null  ·  json iobject  ·  string regexp_replace

xor <boolean1> <boolean2>


Description

    boolean xor

Parameters

    boolean1:   The boolean 1 - boolean - required
    boolean2:   The boolean 2 - boolean - required
admin
xor 1 0
mentdb
1
Used in use cases (2 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    The MQL language in depth › Booleans and feature flags typed by hand
Often used with

    and  ·  not  ·  or  ·  atom get  ·  atom size  ·  case  ·  is empty  ·  is not empty

not <boolean>


Description

    boolean not

Parameters

    boolean:   The boolean - boolean - required
admin
not 0
mentdb
1
Used in use cases (57 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    MQL developer › Add a language and translate the messages of an application
    Backend & web service developer › Signed webhook receiver with replay protection
    Date & time developer › Is the shop open now, and when does it open next
    Data validation developer › Validate an API payload against its contract
    JSON & document store developer › Feature flags stored in a node
    and 51 more in the Use cases
Often used with

    and  ·  atom get  ·  string regexp_replace  ·  execute  ·  json doc  ·  script delete  ·  string contains  ·  while

is null <value>


Description

    Check if the value is null

Parameters

    value:   The value - string - required
admin
is null null
mentdb
1
Used in use cases (21 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    Backend & web service developer › An authentication guard shared with include
    Date & time developer › Weekly sign-up cohorts and day-14 retention
    Data validation developer › Validate an API payload against its contract
    JSON & document store developer › Merge the pages of a paginated API without duplicates
    Script developer › Optional parameters and default values
    and 15 more in the Use cases
Often used with

    script create  ·  script delete  ·  not  ·  string regexp_extract  ·  string regexp_replace  ·  and  ·  json doc  ·  node create

is not null <value>


Description

    Check if the value is not null

Parameters

    value:   The value - string - required
admin
is not null null
mentdb
0
Used in use cases (5 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    Web service developer › PUT with optional fields and optimistic locking
    CRUD & data API developer › Data quality check on the table
    Algorithms in MQL › Fibonacci with a memo stored in a node
    Files & archives manager › Store a base64 attachment, check it, read it, archive it
Often used with

    and  ·  not  ·  atom get  ·  case  ·  execute  ·  is null  ·  node create  ·  node delete

is null or empty <value>


Description

    Check if the value is null or empty

Parameters

    value:   The value - string - required
admin
is null or empty null
mentdb
1
Used in use cases (13 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    Script developer › Optional parameters and default values
    Execution modes › include vs call: checks and activity log
    Web service developer › GET: one order, 404, or the list
    The MQL language in depth › Null, empty and blank fields of an API payload
    Screen & UI developer (sajax) › Modal booking form with date, datetime, time and number pickers
    and 7 more in the Use cases
Often used with

    not  ·  string regexp_extract  ·  is null  ·  json parse_array  ·  or  ·  script create  ·  script delete  ·  string regexp_replace

is empty <str>


Description

    Check if the string is empty

Parameters

    str:   The string - string - required
admin
is empty ""
mentdb
1
Used in use cases (14 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    MQL developer › Catalogue of math and physics constants with eval
    Backend & web service developer › Bulk import endpoint with a line by line report
    Date & time developer › Is the shop open now, and when does it open next
    Data validation developer › Password policy with an entropy estimate
    Algorithms in MQL › Stack and queue with atom lists
    and 8 more in the Use cases
Often used with

    atom get  ·  atom size  ·  not  ·  and  ·  string length  ·  atom get_last  ·  case  ·  date is_after

is not empty <str>


Description

    Check if the string is not empty

Parameters

    str:   The string - string - required
admin
is not empty ""
mentdb
0
Used in use cases (2 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    Control flow › First free meeting slot: nested loops, break and continue
Often used with

    and  ·  atom find  ·  atom get  ·  atom size  ·  break  ·  continue  ·  date is_weekend  ·  is empty

equal <str1> <str2>


Description

    Check if 2 strings are equal

Parameters

    str1:   The string 1 - string - required
    str2:   The string 2 - string - required
admin
equal "str1" "str1"
mentdb
1
Used in use cases (142 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    Backend & web service developer › Signed webhook receiver with replay protection
    Data validation developer › French company VAT number and social security key
    JSON & document store developer › Validate a payload against field rules and answer 422
    Script developer › Back up a script before deleting it
    Execution modes › Stack run postponed until a gate opens
    and 136 more in the Use cases
Often used with

    file mkdir  ·  file delete  ·  script delete  ·  script create  ·  and  ·  file exist  ·  not  ·  atom get

not equal <str1> <str2>


Description

    Check if 2 strings are not equal

Parameters

    str1:   The string 1 - string - required
    str2:   The string 2 - string - required
admin
not equal "str1" "str1"
mentdb
0
Used in use cases (1 recipe)

    MQL beginner › Check a sign-up form with boolean operators
Often used with

    and  ·  is empty  ·  is not empty  ·  is not null  ·  is null  ·  is null or empty  ·  not  ·  or

== <number1> <number2>


Description

    Check if 2 numbers are equal

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
== "25" "25.0"
mentdb
1
Used in use cases (99 recipes)

    MQL beginner › Savings plan: while, repeat, break and continue
    MQL developer › Catalogue of math and physics constants with eval
    Backend & web service developer › Signed webhook receiver with replay protection
    Date & time developer › Run log header and execution timer
    String & encoding developer › Mask personal data before writing a log line
    Data validation developer › Supplier onboarding validation report
    and 93 more in the Use cases
Often used with

    and  ·  atom get  ·  script create  ·  script delete  ·  json doc  ·  while  ·  json iarray  ·  string regexp_extract

!= <number1> <number2>


Description

    Check if 2 numbers are not equal

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
!= "25" "25.0"
mentdb
0
Used in use cases (10 recipes)

    MQL beginner › Check a sign-up form with boolean operators
    MQL developer › User rights as a bitmask
    Data validation developer › Cross-field rules of a hotel booking
    Cryptographer & number theorist › Signing a document hash and the avalanche effect
    Crystallographer & materials physicist › Symmetry operations: rotation angle, order and the crystallographic restriction
    Geneticist & bioinformatician › Sparse gene signature with an L1 logistic regression
    and 4 more in the Use cases
Often used with

    or  ·  and  ·  atom get  ·  atom size  ·  is empty  ·  json doc  ·  math bit_and  ·  math bit_or

> <number1> <number2>


Description

    Check if a number is greater than another

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
> "27" "26.0"
mentdb
1
Used in use cases (122 recipes)

    MQL beginner › Savings plan: while, repeat, break and continue
    Backend & web service developer › Health check endpoint for the load balancer
    Date & time developer › Monthly billing dates and proration of an upgrade
    Data validation developer › Validate an API payload against its contract
    JSON & document store developer › Merge the pages of a paginated API without duplicates
    Execution modes › Errors propagate through nested executes
    and 116 more in the Use cases
Often used with

    atom get  ·  string regexp_extract  ·  json doc  ·  string regexp_replace  ·  execute  ·  script create  ·  and  ·  json parse_array

>= <number1> <number2>


Description

    Check if a number is greater than or equal to another

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
>= "26" "26.0"
mentdb
1
Used in use cases (39 recipes)

    MQL beginner › Shopping cart total: variables and arithmetic
    Date & time developer › Weekly sign-up cohorts and day-14 retention
    Data validation developer › A shared catalogue of data quality rules
    Script developer › Back up a script before deleting it
    Web service developer › API key and limits in server parameters
    Scheduler developer › A frequent job that works only in business hours
    and 33 more in the Use cases
Often used with

    and  ·  json doc  ·  string regexp_replace  ·  atom get  ·  json parse_array  ·  json iarray  ·  string regexp_extract  ·  atom size

< <number1> <number2>


Description

    Check if a number is less than another

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
< "25" "26.0"
mentdb
1
Used in use cases (249 recipes)

    MQL beginner › Savings plan: while, repeat, break and continue
    MQL developer › Stable A/B test buckets from a hash
    Backend & web service developer › Inspect a script and answer with a JSON object
    Date & time developer › GDPR retention: keep, anonymise or delete customers
    String & encoding developer › Write and read a fixed width bank transfer file
    Data validation developer › Validate an API payload against its contract
    and 243 more in the Use cases
Often used with

    and  ·  json doc  ·  script create  ·  script delete  ·  json iarray  ·  while  ·  string regexp_replace  ·  wait

<= <number1> <number2>


Description

    Check if a number is less than or equal to another

Parameters

    number1:   The number 1 - number - required
    number2:   The number 2 - number - required
admin
<= "26" "26.0"
mentdb
1
Used in use cases (132 recipes)

    MQL beginner › Grade a class: for loop, list and case
    MQL developer › Catalogue of math and physics constants with eval
    Backend & web service developer › Signed webhook receiver with replay protection
    Date & time developer › Run log header and execution timer
    String & encoding developer › SQL table and API names from form labels
    Data validation developer › Supplier onboarding validation report
    and 126 more in the Use cases
Often used with

    atom get  ·  atom size  ·  script delete  ·  script create  ·  json doc  ·  string regexp_extract  ·  and  ·  string regexp_replace