Download MetaTrader 5

What can be the utility of the function ArrayIsSeries ?

To add comments, please log in or register
Do you need private account monitoring? The Signals will provide you one!
Alain Verleyen
Moderator
30725
Alain Verleyen 2013.05.23 09:34 

I wonder why this function exist and how it can be used for an useful task ?

There is often confusion among programmers between this function and ArrayGetAsSeries, even in some good articles. Maybe there is historical reason or I miss something.

Laurentiu Octavian Niculescu
6690
Laurentiu Octavian Niculescu 2013.05.24 08:58  

Hi,

I think this is usefull when you retrieve an array from something like a "black-box" function or object class(you are not the programmer of that piece of code)

and you want to know if it's timeseries (current element is  [0]) or not (current element is [ArraySize(theArray)-1] ),

or at least this is how I would use it for an array produce by another "module".

Alain Verleyen
Moderator
30725
Alain Verleyen 2013.05.24 09:05  
launic:

Hi,

I think this is usefull when you retrieve an array from something like a "black-box" function or object class(you are not the programmer of that piece of code)

and you want to know if it's timeseries (current element is  [0]) or not (current element is [ArraySize(theArray)-1] ),

or at least this is how I would use it for an array produce by another "module".

You don't need this function to know if current element is [0], for that you need ArrayGetAsSeries(), a timeseries array can be indexed in both way independently of the fact it's a timeseries. Not only do you not need it but if you use it for that you will have a subtle bug in your code.

Anyway thanks for your reply.

Slawa
Moderator
6840
Slawa 2013.05.24 09:27  

ArrayIsSeries() shows you what the array did you receive via function call.

OnCalculate function gets timeseries arrays - time[], open[], high[], low[] etc. You can pass one of these arrays to some function.

If array is series, then you can see it's origin (client terminal history center) and you cannot change it

Documentation on MQL5: Language Basics / Functions / Event Handling Functions
Documentation on MQL5: Language Basics / Functions / Event Handling Functions
  • www.mql5.com
Language Basics / Functions / Event Handling Functions - Documentation on MQL5
Alain Verleyen
Moderator
30725
Alain Verleyen 2013.05.24 09:50  
stringo:

ArrayIsSeries() shows you what the array did you receive via function call.

OnCalculate function gets timeseries arrays - time[], open[], high[], low[] etc. You can pass one of these arrays to some function.

If array is series, then you can see it's origin (client terminal history center) and you cannot change it

Ok I see, it's very specific use. Thanks.
Laurentiu Octavian Niculescu
6690
Laurentiu Octavian Niculescu 2013.05.24 09:51  

Angevoyeageur,

My first answer was not the best, but not wrong and not related to any bug because I know what to expect from my modules.

Yes, I've checked in the documentation and you're right about the indexing.

Thanks. 

Alain Verleyen
Moderator
30725
Alain Verleyen 2013.05.24 09:56  
launic:

Angevoyeageur,

My first answer was not the best, but not wrong and not related to any bug because I know what to expect from my modules.

Yes, I've checked in the documentation and you're right about the indexing.

Thanks. 

What I mean, is that you can have a bug if you use ArrayIsSeries() to determine indexing. If you have chance, the bug isn't active, but if otherwise you have a bug. ArrayIsSeries don't tell anything about indexing, do you agree ?
Documentation on MQL5: Array Functions / ArrayIsSeries
Documentation on MQL5: Array Functions / ArrayIsSeries
  • www.mql5.com
Array Functions / ArrayIsSeries - Documentation on MQL5
Laurentiu Octavian Niculescu
6690
Laurentiu Octavian Niculescu 2013.05.24 09:58  
launic:

Angevoyeageur,

My first answer was not the best, but not wrong and not related to any bug because I know what to expect from my modules.

Yes, I've checked in the documentation and you're right about the indexing.

Thanks. 

Yes,

I have already agreed :)

Alain Verleyen
Moderator
30725
Alain Verleyen 2013.05.24 10:00  
launic:

Angevoyeageur,

My first answer was not the best, but not wrong and not related to any bug because I know what to expect from my modules.

Yes, I've checked in the documentation and you're right about the indexing.

Thanks. 

I was replying to that above, your first answer was wrong and can lead to a bug.
Laurentiu Octavian Niculescu
6690
Laurentiu Octavian Niculescu 2013.05.24 10:09  
angevoyageur:
I was replying to that above, your first answer was wrong and can lead to a bug.

Wow, you want to give me a lesson :D

Accepted. 

Alain Verleyen
Moderator
30725
Alain Verleyen 2013.05.24 10:17  
launic:

Wow, you want to give me a lesson :D

Accepted. 

No, but in programming the best way if always to be precise and rigorous, and I prefer that all was clear, as I hope some people will read this topic in the future. Obviously nothing personal, I wait for you to give me a lesson soon
12
To add comments, please log in or register