Download MetaTrader 5

Interview with Valery Mazurenko (ATC 2011)

8 December 2011, 07:16
Automated-Trading
0
1 926

Interview on Automated Trading Championship 2011 from 08.12.2011.

The task of writing an Expert Advisor trading on multiple currency pairs is complex both in terms of finding suitable strategies and from the technological side. But if the goal is set clear, nothing is impossible then. It was four times already that Vitaly Mazurenko (notused) submitted his multi-currency Expert Advisor. It seems, he has managed to find the right way this time.

We have not been able to interview him when his Expert Advisor was in TOP-10 but the interest for his trading robot remains. Valery has revealed us his recipe for multi-currency Expert Advisors.

It is not the first time you are participating in the Championship. Has something changed comparing to previous years?

I don't think there are any big changes. The only thing I noticed is the lesser amount of participants disqualified for multiple registrations. A great amount of Expert Advisors work in a risky manner each year and count on luck. I think, trading preferences have shifted towards more simple methods.

What about simple methods? Do they have the right to exist?

Simple methods are good for everyone, as not all programmers can study and create neural networks, for example. And not all traders can explain, what do they need from a network. But a couple of moving averages and statistically calculated stop loss/take profit levels can be mastered by almost all traders and programmers. It is also good for the Championship. If the Expert Advisor is simple, it attracts attention both of experienced traders and newcomers.

Personally, I think that the "core" of an idea should be simple. Though this "core" may be covered then by some complex features.

Have you always had such an idea or have you made such a conclusion after gaining some experience? You have a mathematical background, as far as we know.

I've always had such a point of view and it has proved to be right over the years. It was the Championship where I could finally use my mathematical education appropriately.

You submitted the simple Expert Advisor for ATC 2006 and multi-currency ones for the next competitions. Can you call them simple?

I had much experience writing multi-currency trading robots in MQL4, though it was not an easy task. MQL5 language has greatly simplified this work. I think, there is nothing difficult in application of multi-currency method.

ATC 2011 participant Valery Mazurenko (notused)

Your Expert Advisor shows good results this year. Is that what you've just called "use mathematical education appropriately"?

In my last year interview I told that it is not so difficult to develop relatively "lossless" Expert Advisor (in a reasonable time, of course). Also, I noted that the major problem of most traders is money management that can destroy a good Expert Advisor.

"Good volume" is probably a strong expression. In fact, there is nothing difficult in that. The optimization of the Expert Advisor took approximately one month using MQL5 Cloud Network. Optimization was carried out in several stages.

As I've already noted, optimal F was selected as money management method, while the "fundamental trading equation", as it is called by Ralph Vince, is used as the objective optimization function. Also, there were some issues concerning strategies combining.

In fact, that was all for Math. As for the "good volume", it will be difficult to find anyone who intentionally uses Math even in such a volume.

So, do you mean that a trading robot is a combination of simple trading methods and mathematical treatment of results?

I couldn't say that better. Yes, exactly. Simple trading methods are easy to use for everyone, while most trading robots developers are too lazy to apply Math to the results or they just don't have enough knowledge for that.

What would you say about MQL5 Wizard then?

Honestly, I can say nothing, as I haven't used it for personal reasons. I don't trust Standard library, as I can write everything I need for myself and my Expert Advisor will be 100% faster, i.e. I will have to pay less in MQL5 Cloud Network etc. Novice programmers and traders can use it to check the results of some of their ideas.

What does it mean for you to participate in the Championship?

I wanted to show two things at the current Championship:

  1. it is easy to develop a profitable strategy
  2. how strategies can be combined, in case some of them are loss-making for some time.

The current Expert Advisor contains 7 or 8 strategies having common fixed StopLoss/TakeProfit (allowing to calculate optimal F more easily), while the market entry direction is different. However, the template is also used here:

Let's assume that a, b and c are boolean variables indicating some conditions (for example, а - a growing short middle; b - with RSI less than 30, с - the price is higher than the long middle etc. In general, we have a typical set of conditions).

In that case the intention to buy is described by the following equation:

buy = f1(f2(a, f3(b, c)))

  where f1, f2, f3 return boolean values and take the following form:

  • f1(a) = a or !a (defined before optimization)
  • f2(a, b) = a^b or a&b or  a | b (defined before optimization)
  • f3 looks the same as f2, though with its own logical sign.

Therefore, I only have to select most successful combination of logical operations now to finish my Expert Advisor. And the operations can be selected automatically, not manually. Also, another type of buy function may be selected.

I think, most of our readers are not so sure now, if these methods can be called simple. Any simple idea can be quickly tested in MQL5 Wizard. What features should it have?

The methods are really simple in terms of programming. Of course, it is a bit unusual to apply "exclusive or", but "&&" and "||" logical operators are used almost by everyone. MQL5 Wizard must be developed in the direction of code optimization to allow any idea to be not only checked in the tester but also optimized using MQL5 Cloud Network or without it. Also optimization time must be of the same magnitude with the equivalent Expert Advisor written manually.

For example: buy = !(a & (b ^ c))  - it's quite simple, indeed!

How did you manage to find these 7-8 strategies and combine them into one Expert Advisor. Were you looking for some right method for each currency pair, optimizing and then combining everything into one system or were you acting in some different manner?

I was looking for a suitable logical combination for each currency pair and then I was optimizing "fundamental trading equation" to the maximum by a regular lot. In case PF was more than 1.5 along the whole testing segment, the strategy was accepted. In case of PF<1.5, increasing of the initial deposit for at least 10 times based on the optimal F was needed to accept such a strategy. All the passages with less than 30 trades were simply ignored. And the "fundamental trading equation" was used with a degree, though there is no need in it generally.

The next task was to combine selected strategies in the right proportion. The following task should have been solved for that: I needed to find each strategy weight by the pass number. Since we have 12 pairs allowed for the competition, besides, we need to add one more strategy "no trade" according to Vince, then it was necessary to find a way to set correct weights to satisfy the equation x1 + x2 +... + x11 + x13 = 1.

I've managed to find the way, but it provides 13 embedded cycles. That means that this way is ineffective on such dimensions. Therefore, I've lessened the dimension down to 4. I.e., I've randomly arranged the pairs by 3 and selected the weights of each pair within each triplet. As a result, I've got four strategy triplets. At the last stage I have selected the weights of each triplet within simultaneous work of all four triplets.

One mistake was made at this stage, as these strategies should have been combined not randomly and not by triplets or quadruples. I should have made strategies correlation table and combined strategies with lesser correlation. In that case I would have had a new strategy instead of old two ones and the correlation would have been recalculated anew.

Unfortunately, this idea came to me a bit later but I'm sure that the combination based on correlations would have been more effective than the random one.

It sounds like alchemy. How long does it take to prepare such an Expert Advisor according to that recipe? And for how long does it remain relevant (applicable for online work)?

My preparations with the use of MQL5 Cloud Network took about a month. Depsite this, I saved a lot of time, as the Expert Advisor was ready in a day, all the rest were mechanical movements that didn't distract from other things.

As for relevance, I think, they will remain relevant for several months but actually I don't know. I could spare even less time as the test was carried using all ticks. Though when I was selecting the strategies, I could use OHLC and shorten the time considerably. In that case the preparations would have taken 2-3 weeks.

So, you've managed to solve the main task of any trader? Do you already have automatical trading system creation technology that is possible to be applied for real accounts?

Well, this year's Expert Advisor is a touchstone, I only wanted to show that there is no need to beat brains about 15 moving averages, 12 MACDs and 4 parabolics. Of course, it is not suitable for real trading. If we want to apply it for a real account, then it is necessary:

  1. to use "fundamental trading equation" during strategies selection,
  2. to add standard criteria: PF>1.5, drawdown < X etc.
  3. and to remember that this is the optimal F. Therefore, only the losses limit should be deposited on the account, the rest funds may be used to buy bonds, for example.

But I have rich imagination. I can find plenty of ways for strategies generation. I'm going to try the Expert Advisor based on the principles stated below on a real account after the New Year.

What takes the most part of your personal time - selecting strategies or their realization in a program code?

I think that searching for strategies takes most of the time. Realization is less important and simple enough. Every experienced programmer has ready-made classes, templates and functions they can work with. It will take not so much time for an experienced programmer to create a new Epxert Advisor in MQL5, as it may seem to a novice.

There are some other multi-currency strategies at the Championship. Have you examined them? Any opinions?

I can note the Expert Advisor of ias among multi-currency trading robots, as I think that it has some sensible ideas concerning money management. Also I use MA and BANDS and it is interesting to watch its open positions and compare them with mine. Among single currency trading robots I'd like to note the one of Xupypr - not for the Expert Advisor itself but for the method. In fact Xupypr has handily laughed at complex strategies.

It is said that the Championship Rules force to write multi-currency Expert Advisors, if a trader wants to win. But there have not been winners among them so far.

In my opinion, the rules are actually somewhat unbalanced. it would be better to improve them in this aspect. But a multi-currency trading robot will win sooner or later. For instance, I have profit at two or three symbols out of 12 at the moment. And the first profitable symbol can be met at the fifth strategy. If I had submitted a single currency trading robot, I would have hardly reached that fifth strategy and now my Expert Advisor would have been on the last or second last page. But the number of single currency trading robots is bigger, therefore, the chance that one of them will win is higher. I hope this will change soon.

What about the method of yyy999 from China? Have you tried something similar?

Yes, I have. But all that was useless. This method may be lucky up to a certain time. The only way is to use the method of entries - to divide the funds into several parts and use them piece by piece. But such method is unacceptable on a long-term basis.

I think that the "Balance" field has no sense, as its value has no relation to reality.

It seems that fixed Stop Loss and Take Profit values have been selected in money terms. Would it have been possible to do without them? And what could the result have been?

No, stops and takes have been selected in points at the range 10-100 Stop points and 10-200 Take Profit ones (all points refer to four digits display system). I couldn't have done without SL/TP, as I haven't expected any other exit methods. The only thing I could have done was to make floating stops/takes. But a fixed stop is convenient for the optimal F and a take has been made fixed to simplify the task.

What advice can you give for the participants and spectators?

I'd advice the participants to pay more attention for money management. That will pay off when working on a real account, if not during the Championship. As for the spectators, it is better to analyze not only leading Expert Advisors. And also some of them should not be so aggressive.

Are you ready to share your knowledge and methods with other traders? It seems, you have something to share.

Yes, I'm always ready to share my experience and I've started the project bot4you.biz not so long time ago but it is run on a commercial basis. We write trading robots for plenty of trading systems/platforms. It may be surprising for those who have masetred MQL4/MQL5 languages, that it is much more difficult to write a trading robot for the stock market than the equivalent one for MetaTrader.

Yes, it is a little surprising indeed. How can you explain that?

Perhaps, it is a technical monopoly at the stock market. And the absence of fundamentally new software options. I don't want to publicly criticize the stock market software developers but when you launch any third-party terminal it looks too inconvenient in comparison with МetaТrader 5. Trading automation possibilities have got stuck in the past century.

I wish MetaQuotes company platform entered the stock market segment.

Thank you for your answers, Valery. We wish you good luck in trading and in all your endeavours!

Translated from Russian by MetaQuotes Software Corp.
Original article: https://www.mql5.com/ru/articles/553

Step on New Rails: Custom Indicators in MQL5 Step on New Rails: Custom Indicators in MQL5

I will not list all of the new possibilities and features of the new terminal and language. They are numerous, and some novelties are worth the discussion in a separate article. Also there is no code here, written with object-oriented programming, it is a too serous topic to be simply mentioned in a context as additional advantages for developers. In this article we will consider the indicators, their structure, drawing, types and their programming details, as compared to MQL4. I hope that this article will be useful both for beginners and experienced developers, maybe some of them will find something new.

Here Comes the New MetaTrader 5 and MQL5 Here Comes the New MetaTrader 5 and MQL5

This is just a brief review of MetaTrader 5. I can't describe all the system's new features for such a short time period - the testing started on 2009.09.09. This is a symbolical date, and I am sure it will be a lucky number. A few days have passed since I got the beta version of the MetaTrader 5 terminal and MQL5. I haven't managed to try all its features, but I am already impressed.

False trigger protection for Trading Robot False trigger protection for Trading Robot

Profitability of trading systems is defined not only by logic and precision of analyzing the financial instrument dynamics, but also by the quality of the performance algorithm of this logic. False trigger is typical for low quality performance of the main logic of a trading robot. Ways of solving the specified problem are considered in this article.

Using text files for storing input parameters of Expert Advisors, indicators and scripts Using text files for storing input parameters of Expert Advisors, indicators and scripts

The article describes the application of text files for storing dynamic objects, arrays and other variables used as properties of Expert Advisors, indicators and scripts. The files serve as a convenient addition to the functionality of standard tools offered by MQL languages.