MQL4 Data Types

Overview

MQL4 programs process data of various types. Data types influence processing speed and internal representation.

Basic Data Types

  • **Integers:** char, short, int, long, uchar, ushort, uint, ulong.
  • * Processed fastest.
  • **Logical:** bool.
  • **Literals:** ushort (for symbol constants).
  • **Strings:** string.
  • * Slowest processing due to dynamic memory allocation/reallocation.
  • **Floating-point numbers:** double, float.
  • * Processed using a co-processor, slower than integers due to internal representation complexity.
  • **Color:** color.
  • * Represented as an integer. * Used for visualization and input parameters.
  • **Date and Time:** datetime.
  • * Represented as an integer. * Used for visualization and input parameters.
  • **Enumerations:** enum.
  • Complex Data Types

  • **Structures:** Defined using struct.
  • **Classes:** Defined using class.
  • **Interfaces:** Defined using interface.
  • Type Characteristics

  • **Arithmetic Types:** Integer and floating-point types.
  • **Abstract Data Types:** Complex data types in the context of OOP.
  • **Typecasting:** Implicit type casting is used in expressions unless explicit casting is specified. See [Typecasting](/basis/types/casting).
  • Processing Speed

    1. Integers (fastest) 2. Floating-point numbers (using co-processor, slower than integers) 3. Strings (slowest due to memory management)