Skip to content

Array Functions

Group of Functions for Working with Arrays

Arrays are allowed to be maximum four-dimensional. Each dimension is indexed from 0 to dimension_size-1. In a particular case of a one-dimensional array of 50 elements, calling of the first element will appear as array[0], of the last one - as array[49].

FunctionAction
ArrayBsearchReturns index of the first found element in the first array dimension
ArrayCopyCopies one array into another
ArrayCompareReturns the result of comparing two arrays of simple types or custom structures without complex objects
ArrayFreeFrees up buffer of any dynamic array and sets the size of the zero dimension in 0.
ArrayGetAsSeriesChecks direction of array indexing
ArrayInitializeSets all elements of a numeric array into a single value
ArrayFillFills an array with the specified value
ArrayIsSeriesChecks whether an array is a timeseries
ArrayIsDynamicChecks whether an array is dynamic
ArrayMaximumSearch for an element with the maximal value
ArrayMinimumSearch for an element with the minimal value
ArrayRangeReturns the number of elements in the specified dimension of the array
ArrayResizeSets the new size in the first dimension of the array
ArraySetAsSeriesSets the direction of array indexing
ArraySizeReturns the number of elements in the array
ArraySortSorting of numeric arrays by the first dimension
ArrayCopyRatesCopies rates to the two-dimensional array from chart RateInfo array returns copied bars amount
ArrayCopySeriesCopies a series array to another one and returns the count of the copied elements
ArrayDimensionReturns the multidimensional array rank

What’s new in MQL5

Added functions for quick insertion, deletion, copying and expanding array elements. The new ArraySwap() function swaps the contents of two dynamic arrays of the same type, while the ArrayPrint() function allows you to easily print an array of a simple type or a simple structure in the journal.

For fast and easy visualization, use the Graphics library containing the functions for fast drawing of five chart types with auto scaling, color selection and line smoothing.

Last updated on