MQL4 Reference Conversion Functions

Conversion Functions

This is a group of functions that provide conversion of data from one format into another.

The NormalizeDouble() function must be specially noted as it provides the necessary accuracy of the price presentation. In trading operations, no unnormalized prices may be used if their accuracy even a digit exceeds that required by the trade server.

Function

Action

CharToString

Converting a symbol code into a one-character string

DoubleToString

Converting a numeric value to a text line with a specified accuracy

EnumToString

Converting an enumeration value of any type to string

NormalizeDouble

Rounding of a floating point number to a specified accuracy

StringToDouble

Converting a string containing a symbol representation of number into number of double type

StringToInteger

Converting a string containing a symbol representation of number into number of int type

StringToTime

Converting a string containing time or date in "yyyy.mm.dd [hh:mi]" format into datetime type

TimeToString

Converting a value containing time in seconds elapsed since 01.01.1970 into a string of "yyyy.mm.dd hh:mi" format

IntegerToString

Converting int into a string of preset length

ShortToString

Converting symbol code (unicode) into one-symbol string

ShortArrayToString

Copying array part into a string

StringToShortArray

Symbol-wise copying a string to a selected part of array of ushort type

CharArrayToString

Converting symbol code (ansi) into one-symbol array

StringToCharArray

Symbol-wise copying a string converted from Unicode to ANSI, to a selected place of array of uchar type

ColorToARGB

Converting color type to uint type to receive ARGB representation of the color.

ColorToString

Converting color value into string as "R,G,B"

StringToColor

Converting "R,G,B" string or string with color name into color type value

StringFormat

Converting number into string according to preset format

CharToStr

Conversion of the symbol code into a one-character string

DoubleToStr

Returns text string with the specified numerical value converted into a specified precision format

StrToDouble

Converts string representation of number to double type

StrToInteger

Converts string containing the value character representation into a value of the integer type

StrToTime

Converts string in the format "yyyy.mm.dd hh:mi" to datetime type

TimeToStr

Converts value of datetime type into a string of "yyyy.mm.dd hh:mi" format

 

What's new in MQL5

Added the CharArrayToStruct and StructToCharArray functions for converting the uchar array to the binary sequence and vice versa. This simplifies the exchange of byte data when working with a DLL.

See also

Use of a Codepage