The built-in complex type is a structure with two double fields:
struct complex
|
The built-in complexf type is a structure with two float fields:
struct complexf
|
The complex and complexf types can be passed by value as parameters for MQL5 functions (in contrast to ordinary structures, which are only passed by reference). For functions imported from DLLs, the complex and complexf types must be passed only by reference.
The 'i' suffix is used to describe complex constants:
complex square(complex c)
|
Only simple operations are currently available for complex numbers: =, +, -, *, /, +=, -=, *=, /=, ==,!=.
Support for additional mathematical functions will be added later, enabling the calculation of the absolute value, sine, cosine and others.
One-dimensional array of complex type numbers is meant to handle complex numbers. The vector<complex> entry can be used in template functions.
Two-dimensional array of complex type numbers is meant to handle complex numbers. The matrix<complex> entry can be used in template functions.
One-dimensional array of complexf type numbers is meant to handle complex numbers. The vector<complexf> entry can be used in template functions.
Two-dimensional array of complexf type numbers is meant to handle complex numbers. The matrix<complexf> entry can be used in template functions.