How to access one currency pair data in the indicator of the other one?

 
Hi,
I've been trying to access one currency pair (EURUSD) values in an indicator of another one (USDCHF) but have been running into problems.

I've tried ArrayCopyRates() method. The data returned in the array at any index 'x' does not correspond to the data at index 'x' of the working currency pair.


Example:
----------
I am trying to access "EURUSD" data in an indicator that is being used in "USDCHF" currency pair.

Accessing "EURUSD" data code:
------------------------------------
double rates[][6];
ArrayCopyRates(rates, "EURUSD");

Problem:
----------
At any given index 'x' of "USDCHF"'
'Time[x]' of "USDCHF" is not equal to 'rates[x][0]'

Therefore, accessing rates[x][0] does not return the correct data (of "EURUSD") at any given index 'x' for "USDCHF"!

Please Help!
 
ArrayCopyRates implemented especially for arrays passed to dll functions. what the difference You've discovered? print both data and show me output please. what is the last error code after ArrayCopyRates?
instead of ArrayCopyRates You can use iTime, iOpen etc functions
and please compare rates[x][0] with iTime("EURUSD",0,x)
 
1) ArrayCopyRates does not return any error.
2) iTime[x] and rates[x][0] on the same currency pair returns correct data but returns different data for two differenct currency pairs.

This is why it is happening. Each currency pair is missing some bars sporadically somewhere in the data history. Now, when ArrayCopyRates() or iTime creates/returns the data at time 'x', which is missing in the data history, it skips that bar and now data at 'x' is actually the previous bar at 'x+1' and the remaining data follows it. This shift will occur everytime there is a missing bar in the data history. Since the missing bars in each currency occurs at different places, that result in the shift at different places for different currencies makes the data inconsistent at any given time 'x'.


If you compare the data of two differenct currency pairs using rates[x][0] ( from ArrayCopyRates() ) or iTime[] the time at any given 'x' will not match when the bars are missing in the data history.

Here is the output.
Where 'x' is the index. timeframe is 5 minutes and the time for EURCHF and EURUSD is taken using rates[x][0] and iTime[x]. At x=10, EURCHF is missing bars in the data history and now time at [x] for EURCHF is different from time at [x] for EURUSD!

This is how I am taking data for x:
---------------------------------------
ArrayCopyRates(curr, "EURUSD", Period());
for (int x=0;x<limit;x++) {
datetime t1 = iTime("EURCHF", Period(), x); //for EURCHF
datetime t2 = curr[x][0]; // for EURUSD
string msg = "";
if (t1 != t2) msg = "Mismatch!";
string data = "x:"+x+" (EURCHF) Time:"+TimeToStr(t1) +" (EURUSD)Time:"+TimeToStr(t2) +" "+msg;
Print (data);
}

the output:
------------------
x:0 (EURCHF) Time:2005.09.21 20:20 (EURUSD)Time:2005.09.21 20:20
x:1 (EURCHF) Time:2005.09.21 20:15 (EURUSD)Time:2005.09.21 20:15
x:2 (EURCHF) Time:2005.09.21 20:10 (EURUSD)Time:2005.09.21 20:10
x:3 (EURCHF) Time:2005.09.21 20:05 (EURUSD)Time:2005.09.21 20:05
x:4 (EURCHF) Time:2005.09.21 20:00 (EURUSD)Time:2005.09.21 20:00
x:5 (EURCHF) Time:2005.09.21 19:55 (EURUSD)Time:2005.09.21 19:55
x:6 (EURCHF) Time:2005.09.21 19:50 (EURUSD)Time:2005.09.21 19:50
x:7 (EURCHF) Time:2005.09.21 19:45 (EURUSD)Time:2005.09.21 19:45
x:8 (EURCHF) Time:2005.09.21 19:40 (EURUSD)Time:2005.09.21 19:40
x:9 (EURCHF) Time:2005.09.21 19:35 (EURUSD)Time:2005.09.21 19:35
x:10 (EURCHF) Time:2005.09.21 19:20 (EURUSD)Time:2005.09.21 19:30 Mismatch!
x:11 (EURCHF) Time:2005.09.21 19:15 (EURUSD)Time:2005.09.21 19:25 Mismatch!
x:12 (EURCHF) Time:2005.09.21 19:10 (EURUSD)Time:2005.09.21 19:20 Mismatch!
...
and so on...
 
it's easy. see on the chart and You'll discover missing bars. there is no bug. no ticks - no bar. for synchronization of your data use iBarShift function
 
Thank you so much for your help. iBarShift() does the magic. That's exactly what I was looking for.
Is this something recently added to MT4? I don't remember seeing it in the past.