Download MetaTrader 5

Libraries: sToken

To add comments, please log in or register


The script contains a class, that can be used to solve mathematical and logical expressions, defined as string.

The script has two classes: cTokenBase and cToken (a member of CTokenBase). The cTokenBase class must be configured before its use (see below).

The following MQL5 mathematical functions are supported: abs, arccos, arcsin, arctan, ceil, cos, exp, floor, log, log10, max, min, mod, pow, rand, round, sin, sqrt, tan.

Logical and math operations:  /, %, *, +, -, >, <, >=, <=, ==, !=, &&, ||.

The expression may contain numbers, including double numbers, user variables and user arrays. If you will use the user's variables and arrays, you need to add functions, that returns the values of these variables and arrays. The functions should be added into the cTokenBase class.

The user variables and arrays are named with letters (the case isn't important), the array elements are defined as follows: e[0], e[1], f[0], f[1].

Author: Дмитрий

sToken demo expressions

sToken demo results

To add comments, please log in or register