![Multi currency EA ideas Multi currency EA ideas](https://c.mql5.com/36/30/multi-currency-ea-ideas.jpg)
- 2014.02.25
- www.mql5.com
Multi-Currency Expert Advisors in MT5 - backtesting and optimization
The threads/posts
- Buying or Selling all 7 pairs - the thread with the explanation.
- Multi-Currency Expert Advisors the post with the examples of backtesting/optimization
The articles
- LifeHack for trader: "Quiet" optimization or Plotting trade distributions
Interesting results can also be obtained by running a multi-currency EA in the strategy tester. As an example, the free Multicurrency Expert from the CodeBase was used. In addition, the "#include <DistributionOfProfits.mqh>" file was specified and the "CDistributionOfProfits ExtDistribution" variable was declared in the header of the EA, and the "OnTester()" function was added at the end of the code. After a single run, the following statistics had been received: "TestAnalysis.htm". - How to Test a Trading Robot Before Buying
optimization it over all symbols selected in Market Watch - Creating a Multi-Currency Multi-System Expert Advisor
- Creating an Expert Advisor, which Trades on a Number of Instruments
Documentation
- MetaTrader 5 Help → Algorithmic Trading, Trading Robots → Optimization Types - All Symbols Selected in Market Watch
- MetaTrader 5 Help → Algorithmic Trading, Trading Robots → Strategy Testing - Multi-Currency Expert Advisors
- MetaTrader 5 Help - Trading Platform — User Manual
CodeBase
- Multi-currency night scalper - Night Scalper Multi - expert for MetaTrader 5
- Multi-symbol Two iMA Simple - expert for MetaTrader 5
- and more on CodeBase here (the link to the search result).
![Multi-currency night scalper - Night Scalper Multi Multi-currency night scalper - Night Scalper Multi](https://c.mql5.com/36/30/multi-currency-night-scalper-night.jpg)
- www.mql5.com
I've already read all these.
the use of ontick function isn't working well in the tester because when the symbol the multi ea attached to is changed the results change also.
the ontimer function seems to be working but it's very slow in the tester when trying optimization.
so i found that the chart event and book event is going to work somehow but the examples available about it the complex or simple but not explained well
all the examples have a hex number that i don't understand how it check the ticks with.
so please give a simple code that explain how to deal with the event handling for checking ticks for other symbols.
hi my friend .
The best multi-currency strategy is to use currency correlation and lock profits and losses. In this case, the entry and exit of the market process does not need to know the market direction
EA:
string Symbol[]={"AUDUSD","EURUSD","GBPUSD","USDCHF","USDCAD","USDJPY"}; int handle[],size; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- long chartID=ChartID(); ArrayResize(handle,size=ArraySize(Symbol)); for(int i=0;i<size;i++) if((handle[i]=iCustom(Symbol[i],_Period,"OnTick",chartID,i))==INVALID_HANDLE) return(INIT_FAILED); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- for(int i=0;i<size;i++) IndicatorRelease(handle[i]); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick(const string &symbol,const double &price) { //--- Print(symbol," ",price); } //+------------------------------------------------------------------+ //| ChartEvent function | //+------------------------------------------------------------------+ void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam) { //--- if(id>=CHARTEVENT_CUSTOM) OnTick(sparam,dparam); } //+------------------------------------------------------------------+
Indicator:
#property indicator_chart_window #property indicator_applied_price PRICE_CLOSE //--- input parameters input long ChartID=0; input ushort EventID=0; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- indicator buffers mapping //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const int begin, const double &price[]) { //--- if(prev_calculated) ::EventChartCustom(ChartID,EventID,rates_total,price[rates_total-1],_Symbol); //--- return value of prev_calculated for next call return(rates_total); } //+------------------------------------------------------------------+
EA:
Indicator:
Thanks for your help.
Forum on trading, automated trading systems and testing trading strategies
Sergey Golubev, 2024.06.01 14:18
Developing a multi-currency Expert Advisor (Part 1): Collaboration of several trading strategies
Forum on trading, automated trading systems and testing trading strategies
Sergey Golubev, 2024.06.05 06:47
We are now only interested in testing the suitability of this approach, and not the efficiency of its implementation. Therefore, within the framework of this article, we will try to develop at least some working implementation of this approach, which later will help us build a more beautiful one from an architectural point of view since we will already have knowledge on how to avoid mistakes.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello
I'm trying to build a multi currency ea that works in the mt5 strategy tester.
i'm not a professional programmer but i tried i've read the articles on this website about that and tried but with no luck i couldn't understand the method because they use about 3-5 include files linking to each other and it became over overwhelming.
so please any one give me an example within a small direct code of how can i use the OnChartEvent() and the OnBookEvent() to check whether there is a tick on the other symbols or not.
Thanks in advance