Download MetaTrader 5

Discussion of article "MQL5 Programming Basics: Arrays"

To add comments, please log in or register
MetaQuotes Software Corp.
Moderator
187122
MetaQuotes Software Corp.  

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
Moderator
33296
Alain Verleyen  

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
Moderator
33296
Alain Verleyen  

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.
546
Al.  
A very helpful well-explained article, thankyou Dmitry Fedoseev.
Czarodziej
16
Czarodziej  
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
22
steve.vanlaer  
Many thanks for this extended review
To add comments, please log in or register