In Part 73 we finished our discussion on loading series arrays with rate data. In this installment we’ll talk about other array functions that deal directly with series arrays.
int ArrayCopySeries(double&array, int series_index, string symbol=NULL, int timeframe=0) – this function is similar to the ArrayCopyRates() function with the exception that the resulting array is a single dimensions and contains only the data from a single series. Also similar to ArrayCopyRates(), if you only pass the array name to the function, it will assume the current chart pair and the current chart time frame and it will automatically dimension the array to the number of candles available in your chart.
The series index is the series array identifier:
MODE_OPEN – loads the array with the Open prices of each candle for the designated symbol and time frame
MODE_LOW – loads the Low prices
MODE_HIGH – loads the High prices
MODE_CLOSE – loads the Closing prices
MODE_VOLUME – loads the Volume level of the candle in lots
MODE_TIME – loads the candle open times
The other parameters that can be passed are the symbol and the time frame.
The first example loads our array HighPrice with the highs of the candles in the current chart:
double HighPrice; int Count;
Count = ArrayCopySeries(HighPrice,MODE_HIGH);
The second example loads our array CandleTime with the candle opening times of the daily USDJPY candles:
datetime CandleTimes; int Count;
Count = ArrayCopySeries(CandleTime,HIGH_TIME,"USDJPY",1440);
Again, as with the ArrayCopyRates() function, if you request data from another pair or time frame and the pair/time frame combination has never been accessed in the MT4 platform in which this is run, the data will be requested and you will have to execute the ArrayCopyRates() function a second time to retrieve the data. If that is the case, the function will return a -1 and the GetLastError() function will return a 4066 (ERR_HISTORY_WILL_BE_UPDATED) error. So be sure to use the loop described in Part 72 catch that error.
Allow me to digress here for a moment. I want to talk about trade volumes on MT4 platforms. As you well know, the Forex market is a distributed market and is not controlled by a single exchange (like the NYSE, CME or CBOT.) For that reason there is no definitive place to retrieve actual trade volumes. I haven’t done any extensive research on this subject, so allow my comments to be a starting point for discussion. But I believe that the volume information that can be seen in our MT4 platforms is specific to our broker, or a group of brokers. Since I began my trading experience in the futures market, many of the strategies that I prefer to use require volume confirmation of the price action. My assumption to this point has been that the volume information on my MT4 platform is a representative sample of the whole market. That’s the only assumption from which I can operate, although I can see that it may not be representative of the whole market, but rather just representative of retail traders – which could make a big difference in confirming price action. Any light you readers can shed on this subject would be helpful.
Thanks for your attention and please follow me on Twitter and LinkedIn.
Latest posts by admin (see all)
- 10 Things You Need To Know About Fibonacci - December 13, 2017
- The Secret of Taking Profit and Why it is Important - December 9, 2017
- Martingale Strategy: All or Nothing and all Risk - December 9, 2017
Winner’s Edge Trading, as seen on: