What can be the utility of the function ArrayIsSeries ?

 

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.

 

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".

 
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.

 

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
 
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.
 

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. 

 
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
 
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 :)

 
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.
 
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. 

 
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
Reason: