Buying or Selling all 7 pairs - page 3

 

Developing a multi-currency Expert Advisor (Part 4): Pending virtual orders and saving status

Developing a multi-currency Expert Advisor (Part 4): Pending virtual orders and saving status

In the previous article, we have significantly revised the code architecture to build a multi-currency EA with several parallel working strategies. Trying to achieve simplicity and clarity, we have so far only considered a certain minimum set of functionality. Even considering the limitations of our task, we have significantly altered the code from the previous articles.

Now hopefully we have the groundwork that is sufficient enough to increase functionality without radical changes to the already written code. We will try to make a minimum number of edits only where it is really necessary.

Developing a multi-currency Expert Advisor (Part 4): Pending virtual orders and saving status
Developing a multi-currency Expert Advisor (Part 4): Pending virtual orders and saving status
  • www.mql5.com
Having started developing a multi-currency EA, we have already achieved some results and managed to carry out several code improvement iterations. However, our EA was unable to work with pending orders and resume operation after the terminal restart. Let's add these features.
 

Developing a multi-currency Expert Advisor (Part 5): Variable position sizes

Developing a multi-currency Expert Advisor (Part 5): Variable position sizes

In the previous part, we dded the ability to restore the EA's state after a restart. It does not matter what the reason was - rebooting the terminal, changing the timeframe on the chart with the EA, launching a more recent version of the EA - in all cases, restoring the state allowed the EA not to start working from scratch and not to lose already open positions, but to continue handling them.

However, the size of the opened positions remained the same for each instance of the strategy throughout the entire testing period. Their size was set at the EA launch. If, as a result of the EA's operation, the trading account balance increased, then this would allow the use of an increased position size without increasing risk. It would be reasonable to take advantage of this, so let’s start implementing the use of variable position sizes.

Developing a multi-currency Expert Advisor (Part 5): Variable position sizes
Developing a multi-currency Expert Advisor (Part 5): Variable position sizes
  • www.mql5.com
In the previous parts, the Expert Advisor (EA) under development was able to use only a fixed position size for trading. This is acceptable for testing, but is not advisable when trading on a real account. Let's make it possible to trade using variable position sizes.
 

Forum on trading, automated trading systems and testing trading strategies

How to Start with Metatrader 5

Sergey Golubev, 2024.08.10 10:59

Developing a multi-currency Expert Advisor (Part 6): Automating the selection of an instance group

Developing a multi-currency Expert Advisor (Part 6): Automating the selection of an instance group

In the previous article, we have implemented the ability to choose the strategy option - with a constant position size and with a variable position size. This allowed us to introduce normalization of the results of the strategies' work according to the maximum drawdown and provided the possibility of combining them into groups, for which the maximum drawdown was also within the specified limits. For the sake of demonstration, we manually selected several of the most attractive combinations of inputs from the optimization results of a single strategy instance and tried to combine them into one group or even into a group of three groups of three strategies. We got the best results in the latter case.

 

Forum on trading, automated trading systems and testing trading strategies

How to Start with Metatrader 5

Sergey Golubev, 2024.08.24 11:27

Developing a multi-currency Expert Advisor (Part 7): Selecting a group based on forward period

In the previous articles, I have been optimizing individual instances of trading strategies on the same time period - from 2018 to 2022. This is a fairly long period, which surely includes various events affecting the price dynamics. On the other hand, it is not too large and the time of one run remains small enough — within a few tens of seconds. The selected period is arranged so that there is still more than a year left until the current moment in time. This makes it possible to see how the strategy instances will behave in the section of history that was not used when optimizing their parameters.

 

Forum on trading, automated trading systems and testing trading strategies

How to Start with Metatrader 5

Sergey Golubev, 2024.08.31 09:20

Developing a multi-currency Expert Advisor (Part 8): Load testing and handling a new bar

In the first article, we have developed an EA featuring two instances of trading strategies. In the second one, we have already used nine instances, while in the last one this number jumped to 32. There were no problems with testing time. It is clear that the shorter the time of a single test pass, the better. But if the overall optimization takes about a few hours, this is still better than several days or weeks. Likewise, if we have combined several strategy instances in one EA and want to see its results, then a single pass should be completed in seconds or minutes, not hours or days.

Let's try to find out how the time of a single pass in the tester depends on the number of instances of trading strategies for testing periods of different durations. Let's also look at the memory consumed. Of course, we need to see how EAs behave with different numbers of trading strategy instances when launched on the terminal chart.