Download MetaTrader 5

Discussion of article "MQL5 Programming Basics: Arrays"

To add comments, please log in or register
Do you know that MQL5 is an object-oriented language?
MetaQuotes Software Corp.
MetaQuotes Software Corp. 2013.03.11 14:09 

New article MQL5 Programming Basics: Arrays is published:

Arrays are an integral part of almost any programming language along with variables and functions. Many novice programmers are often afraid of arrays. It sounds strange but it is true! I can assure you that they are not scary at all. In fact, arrays are similar to regular variables.

Multidimensional array

Is it possible that the reason why arrays are seen as something complicated is somehow related to the use of "[" and "]"? These symbols are rarely used anywhere other than in programming when working with arrays, so their location on the keyboard can fade from one's memory and cause discomfort. While in fact, you can easily remember where they are - these two keys are situated next to "Enter" in a logical order: the opening bracket is followed by the closing bracket.

Author: Dmitry Fedoseev

Alain Verleyen
Alain Verleyen 2013.03.15 22:29  

Very good article, for absolute beginner, but also for experimented programmer new to MT5. Only last section "Creating Multidimensional Arrays Using OOP" is of least interest.

Altough, a little error :

Array indexing order can be determined using the ArrayIsSeries() function:

bool series=ArrayIsSeries(ar);

If the array is indexed in reverse order, the function will return true.

This is false. Function to use to know indexing order of an array is ArrayGetAsSeries().

ArrayIsSeries() is used to determine if an array is a TimeSeries.

Alain Verleyen
Alain Verleyen 2013.03.16 09:24  

There is only one method that allows you to do a search in an unsorted array

This is not strictly true, have a look at Hash Based Searching Algorithm. But this algorithm is  probably not applicable to trading.

Al. 2013.03.21 17:05  
A very helpful well-explained article, thankyou Dmitry Fedoseev.
Czarodziej 2015.06.24 22:36  
MetaQuotes Software Corp.:

New article MQL5 Programming Basics: Arrays is published:

Author: Dmitry Fedoseev

1 Question:

#define SIZE_X 3;


int ArrayName[SIZE_X];

Compiler forbids such construction. Why?

steve.vanlaer 2015.11.04 18:44  
Many thanks for this extended review
To add comments, please log in or register