I encountered a problem with MT4 as many of you for sure did as well... No possibility to backtest EAs which trades on more than one currency pair.
For the sake of explanation, here is a simple strategy: Take two correlated pairs (GBPUSD and EURUSD), plot MA on both, if on one price is X pips below MA and on the other one price is X above MA, "bet" on the return to MA on both currencies - long and short - since EURUSD nad GBPUSD are correlated, we are "kind of" hedged. No SL/TPs. Closing BOTH positions when one of the currencies touches its MA.
Now, how the hell to test it? My idea was to run two separate tests on two MT4 terminals while both strategies would communicate with each other through shared CSV file.
Question: does any of you have an experience with smth similar to this? I see the problem with synchronizing both tests. Thus, every minute one tester would have to "wait" for the other one to catch up - make them work/trade synchronized. Communication through csv would serve sharing the conditions of entering/closing positions such way, it would happen simultaneously.
Questions2: is it possible to somehow "pause" the tester from processing another tick, until the second EA catches up to the same beginning of a candle and writes it into the csv? (this seems to me as the major problem)
Then we would receive two separate results, which is a matter of seconds to combine them together...
Thank you for any input/idea!
Nope, then I would rather simulate it in R
Come on guys, it must be somehow possible in MQL4!
You can test your current multicurrency strategy using open prices mode in MT4 just out of box. Just run it on all symbols one by one, then aggregate results (you may get a tool for this in my blog - Lightweight html5-tools for tester report and statement analysis).
MT4 tester simulates ticks for only one current symbol, BUT you have all OHLC data and indicators (including MA) on bars for other symbols.
You can even run the test by ticks, but this will be an approximation of trade, because symbols other than work symbol will change price and indicators' values only once per bar.
MT4 tester simulates ticks for only one current symbol, BUT you have all OHLC data and indicators (including MA) on bars.
Im not sure I understand.
The issue with my strategy is that the conditions from more than one currency pair must be fullfilled in order to trade. (condition1 on EURUSD and condition2 on GBPUSD). Therefore, running it "one by one" would not work. The same applies for closing trades (information from more than one currency pair needed)
If you can afford to calculate conditions on OHLC prices (OHLC for all completed bars, and only open price for bar 0), then you can do it. You can see in the abovementioned blog how I use this method for multi-currency expert, which reads all forex major currencies strengths - which are in essense a combination of moving averages.
Run your expert as usual on different work symbols. You'll get trading errors for all symbols except for work symbol, so your expert should be coded to handle this situation gracefully in the tester.
I am starting to follow!
I put together simple code just to test the basic things... And this works :o Now I feel kind of dumb I did not try it before... Even though, order/position management will be quite complicated with this (I enjoy using certain martingale principles in my strategies (increasing lots by 1.1-1.3 ratio, etc. :-P)), but definitely now more doable then before!
I will not manage to test the whole thing today, in case I would need another help, will let you know, guys.
Thanks a lot!
extern string cur1 = "EURUSD+";
extern string cur2 = "GBPUSD+";
if(Bars != B)
B = Bars;
Print("EURUSD ", NormalizeDouble(iClose(cur1, 0, 0), Digits));
Print("EURGBP ", NormalizeDouble(iClose(cur2, 0, 0), Digits));
Print("EURUSD: EMA: ",NormalizeDouble(iMA(cur1, 0, 200, 0, 1, 0, 0), Digits));
Print("EURGBP: EMA: ",NormalizeDouble(iMA(cur2, 0, 200, 0, 1, 0, 0), Digits));