Trader’s Tech – Writing Your Own EA Part 75 – Arrays

Forex Robot

Whew! It might actually be cooling in northern Texas a little bit. That’ll be nice.

If you’re new to this series and want to check it out from the beginning, you can find that here. And look here for a list of all the programming articles.

In Part 74, we talked about the ArrayCopySeries() function and I digressed somewhat with a discussion of trade volumes on the MT4 platform. Here we’ll discuss some additional series and other multi-dimensional array functions.

int ArrayDimension(object array[])) – this function will return the number of dimensions for which the object array[] is dimensioned.

This would be handy if you wanted to write a function that performed a calculation on the array that was passed. The function could be written to handle multiple dimensions making it much more versatile.

bool ArrayGetAsSeries(object array[]) – this function will test your array and return a true if the array is organized as a series array (indexed top to bottom.)

bool ArrayIsSeries(object array[]) – this function will return true if the array is actually a series array (Time[],Open[],Close[],High[],Low[], or Volume[].)

The difference between a series/series-organized array and a regular array is that there is no memory set aside for a series array, the data is stored in the same memory location that the actual price data is stored. Because it’s actual rate data, a series array cannot be initialized with different values.

bool ArraySetAsSeries(double&array[], bool set) – this function will set the indexing direction of the array. “If the set parameter has the TRUE value, the array will be indexed in a reversed order, i.e., the last element has a zero index. The FALSE value sets a standard indexing order. The function returns the previous status. ” Quoted from here.

And that’s a wrap on arrays. Next time we’ll revisit our discussion of chart drawing objects and some tricks I use in their placement.

Thanks for your attention and please follow me on Twitter and LinkedIn.


The following two tabs change content below.
Winners Edge Trading was founded in 2009 and is working to create the most current and useful Forex information and training available on the internet.

Winner’s Edge Trading, as seen on:

Winner's Edge Trading in the news