Is it possible to input prices from multiple pairs into a single EA?

 

Hi all,


I apologise if this is a silly question (I had a bit of a search but couldn't find the answer to this), but is it possible to import price data from multiple pairs into a single EA? For example, let's say I am creating an EA which will place trades on the EUR/USD, but my decision as to whether or not to execute those trades is based on what the USD/CHF and USD/JPY pairs are doing. Am I able to import price data from the USD/CHF and USD/JPY into an EA placing trades on the EUR/USD?


Regards,

Elliott

 

Yes.

https://www.mql5.com/en/docs/series/copyrates

Documentation on MQL5: Timeseries and Indicators Access / CopyRates
Documentation on MQL5: Timeseries and Indicators Access / CopyRates
  • www.mql5.com
Gets history data of MqlRates structure of a specified symbol-period in specified quantity into the rates_array array. The elements ordering of the copied data is from present to the past, i.e., starting position of 0 means the current bar. If you know the amount of data you need to copy, it should better be done to a statically allocated...
 
Anthony Garot:

Yes.

https://www.mql5.com/en/docs/series/copyrates

Thanks Anthony. So I can just place each individual pair's price data into each successive row of an array (that is how I had thought I would do it in the first place)? I notice that the help document mentions historical data: I was wanting to know about live price data however.  Most of the other help document topics I have seen relating to getting price data also refer to the "current symbol".

So I'd just like to confirm that it is possible to have my EA analysing price data from the USD/CHF and/or USD/JPY whilst placing trades on the EUR/USD?

Thanks again.

Elliott

Reason: