Data Extraction and Comparison

Technical Question. It’s late at night and I just may not be seeing this clearly so bear with me.

I know Bars returns the number of bars currently displayed on screen. However I’m trying to retrieve several pieces of data across various currencies and am unable to do so. For example I’d like to export all open, close values of various currency pairs from Jan 1 1990 onwards through one indicator.

Code is pretty basic:

For (int i =1; i<Bars; i++) {

FileWrite (handle, iClose(“USDCHFm”, PERIOD_D1, i), iClose(“EURUSDm”, PERIOD_D1, i);

}

But the Bars functionality caps out with the bars I can see on screen. I tried variations of DateTime instead of Bars and the data seems to only want to go back to the dates available on my screen. In other words, I have to manually scroll until Jan 1, 1990 to extract data I want. This would be fine, but since I’m running some comparisons, I’d like to be able to do this across various currency pairs at once.

Suggestions?