indicators for other symbols in tester

 

I see how to get market data for other symbols using MarketInfo() as described in other posts, but how can I pass this data to the indicator functions? EG, I've got an EA that's trading on EURUSD and I want it to trade based on the SMA for USDJPY. In ordinary circumstances I'd just specify the symbol in the indicator method, but this doesn't work in tester, and MarketInfo() only provides raw price data. Is there any voodoo I can use to accomplish this so I can backtest my EA?

 

It's a challenge, to do so but it can be done. Essentially, your EA for the tester will have LOTS of special code that is not included in the EA you eventually use in live trading.


First you need to learn how to FileWrite and FileRead data from a csv file.


Then you run a data collector EA of your own creation on the USDJPY history and FileWrite the desired data to the csv file. You will have to include a unique time related identification number for each piece of data that can be used when the newly collected data is accessed in the EA that uses the collected data. That same unique ID number will be regenerated in the tester EA on the EURUSD history data, and the EA has to compare the two ID number to ensure the collected data is being applied at the correct time. Personally I use a large interger that is generated as follows: Year + Day of Year + Bar Number for a given timechart

Thus, the ID number for the 82nd M5 bar of the 143rd day of 2009 looks like this: 2009143083


After the data is collected it is best to read the data into an array in your EA so it can access the collected data efficiently instead of trying to read if from the csv file every time you need a piece of collected data.


Cheers

Reason: