Download MetaTrader 5

Interview with Alexandr Artapov (ATC 2012)

18 December 2012, 09:36
Automated-Trading
0
2 522

Interview on Automated Trading Championship 2012 from 07.12.2012.

It was during the second week of the Championship when the Expert Advisor of Alexandr Artapov (artall) found itself on the third position trading EURUSD and EURJPY. Then it briefly left TOP-10 to appear again after one month of struggle for survival. As it turned out, this trading robot is still having something up its sleeve. It just needs some time to wait for the new levels on the trading account.

Hello, Alexandr! How did you start your trading activity?

Hello and welcome to all the participants of the sixth annual Automated Trading Championship - ATC 2012.

I became interested in trading in 2000 when I occasionally bought the Valyutny Spekulyant ("Currency Trader") magazine. Besides, I always wondered, who those yelling and running people in the "pit" were? Apart from articles, reviews and interviews, that magazine also contained some publications on programming of a candle chart using MetaStock language. I realized that it is possible to convert this thing to mathematical language to automate some routine tasks. I started looking for sources of information on the subject, trawled the net and opened demo accounts. That is how a I've become really interested in all that.

I started manual trading in autumn of 2000. I've managed to experience all nuances of ups and downs - both of the market and of my mood. Since I've always been interested in programming as the branch of Math, I tried to convert my emotions, as well as ideas and strategies to the programming language along with manual trading.

Looking for the possibility of the automated trading, I have found MetaTrader (it was the third version), studied the language and tried to write some simple codes. I thought that if these things are called Expert Advisors, then they should give some advice on what, where and when to buy or to sell. I became interested in scripts gathering data from various indicators and various time frames into a single table with arrows. I still can use such scripts in manual trading. Perhaps, that is the reason of my devotion to multicurrency trading. If one market is flat, then the second one is about to start moving.

However, I started developing complex Expert Advisors only when MQL4 was released. One of my Expert Advisors participated in ATC 2006.

So, you are not a newcomer on the Championship? Have your views and opinions about trading undergone some changes over the last year?

Yes, you can say so. I participated in the competition each year except 2010. As for the changes... Well, each year provided me with some new ideas. As you can see, the index number of my Expert Advisor has exceeded 500 already. :) There were some Expert Advisors developed under the impression of the victory of one of the participants and his neural network but in most cases the robots were based on levels, candlesticks, filters of standard and custom indicators with different ideas about MM, as well as on stop levels and order (position) trailing. The main thing that unites all these ideas is Multicurrency trading. Right after I examined the Championship Rules, I had no doubts that I should develop a multicurrency Expert Advisor. I started looking for such a possibility in MQL4.

The Championship conditions are quite tough - not much time, many professional and experienced programmers. You should always be in the market and have good luck, of course. This year, I decided to experience all the niceties of having a 15 lot position at 3-6 symbols. It is necessary to find and pull a couple of "leading" symbols out to the necessary margin level and then deal with other ones. That is how my views have been changing year by year, while the basics remained intact and accumulated.

However, it concerns only Championship trading robots and has nothing to do with real trading ones with their daily boring tiny profits or dramatic fails at stop levels. No matter what the levels or entry/exit filters are, they are always equitable in relation to Buy and Sell deals. There is no sense in fitting these parameters to the current market condition. These are my views.

My nickname has been mentioned in one of the reviews in relation to allegedly unclear Expert Advisor's multicurrency principle. So, anticipating the question about my current Expert Advisor, I should tell that it started its operation well on EURUSD and EURJPY but failed to trade USDCAD due to a sad code error; therefore, only these two "leading" pairs will be traded now till the next balance level. Now, all I have to do is to wait and see if that level is reached.

Alexandr Artapov (artall) - Participant of the Automated Trading Championship 2012

Yes, I was just going to ask a question about your multicurrency Expert Advisor. How did you select the pairs for the current Championship?

Actually, selection of symbols was a simple matter. I have selected the pairs (including cross ones), which were allowed for using and performed well during the test period (and usual trading) following the instructions of the specified indicator. These pairs are EURUSD, EURJPY, USDCAD, GBPUSD, GBPJPY, EURGBP, AUDUSD - 7 in total.

As I've already mentioned, they operate in packs up to strictly specified account balance sizes. Only EURUSD can operate having the balance less than the initial deposit until the profitable area is reached.

The pairs are integrated in the following way - EURUSD, EURJPY, USDCAD operate up to a certain level, they are followed by GBPUSD, GBPJPY and EURGBP, AUDUSD joins last. I don't know if this idea is new but I like it. The free margin is used up to 90%, the lot is increased or decreased depending on the balance curve. Generally, such behavior is consistent with the competitive spirit - "Faster, Higher, Stronger". ;)

MetaTrader 5 and MQL5 are nice things. They allow doing a lot and encourage imagination. However, multicurrency testing and debugging took pretty much time and effort. Visual testing and forward tests were the only helpers.

Well, and the last thing that should be mentioned about my Expert Advisor - I have selected OnChartEvent() events coming from each operating (on the current level) balance for each symbol every 30 minutes. I also used my favorite ATR indicator for setting Stop-loss and Take-profit levels, no trailing.

You've mentioned about some error in the Expert Advisor preventing it from trading USDCAD. How much attention do you pay to error handling when developing a trading robot?

I focus much attention on that when testing and debugging the code. Basically, I use Print (printf) and, sometimes, Alert and Comment everywhere I could. Buy/sell signals (arrow object) are generated by the indicator itself. This is clearly visible during visualization and trading. At the last stage (somewhere in August if I'm not mistaken) new MQL5 update having code profiling has been released (measuring speed and number of function and indicator operations etc.). This feature has also helped to improve and optimize some things. As for USDCAD, it was a sad mistake, as I've already said. I don't want to talk about it.

I was totally shocked during the first competition days when two positive positions had not closed when passing from one trading day to another. Well, I thought, this is the end - the execution strategy is completely disrupted. However, all turned out to be OK. The robot added to the open positions in the morning. As the proverb says, "you reap what you sow". What a buzz I've made about that on the forum... Oh, well, never mind. Nevertheless, ambiguity has remained unresolved.

You have finished the second week of the Championship on the third position and the balance has not increased much during the last 7 months. Was it a market change or some miscount in the trading strategy?

No, the Expert Advisor is working as a charm (except USDCAD). ;) The market has become less volatile with frequent changes of direction. On the average, direction changes each 7.5 hours (after every 15 bars on M30). I think my Expert Advisor would be much more secure if it added to existing positions but it is constantly reversing at the moment.

Well, market is market, of course. There were plenty of various news recently - USA presidential election, as well as Greece and Spain vs Germany...

I don't believe in straight growing balance curves. They seem to be rather artificial for me, they contradict the market logic. And what if they won't be able to wait out the losses? What will happen then?

The Expert Advisor enters the market step by step while exiting in a one deal. Are the stop levels activated or does the strategy itself imply such an action? And why is market entry performed step by step - receiving signals from various systems?

According to the strategy the free margin is blocked within a minute for new possible signals from other symbols. In case there are no such signals, the remaining margin is used within a reasonable scale. The check is performed, of course. Exits are performed by stops/takes, changing trading days in case of a positive balance and reverse signal having a volume within 5 lots. The new position is opened after the market exit.

But I've already told too much about the Expert Advisor. Let's change the subject! On the other hand, everyone knows everything already, there are no secrets any more. So, we may continue. I have plenty of ideas and I also have possibilities for their implementation.

So, the single strategy is actively working on all pairs? Have you tried to implement several strategies per one symbol within a single trading robot?

No, I haven't. Though I had some ideas... This will be much more difficult, as it will take too much time and require too much testing. It will be even more difficult if the periods are implemented. The algorithm contains lots of enumerations, arrays, loops and checks. Testing is problematic already considering the number of the current symbols.

I've tried to optimize the same parameters for all symbols without much success! Each pair has its "own character" described by ATR indicator; I tried to assign custom time filters (see above) to each of them with no result!...

Now, I think if I can take one/two symbols (the maximum number) and several A. Elder levels and several strategies. Perhaps, I will manage to develop something useful.

How did you select the currency pair triplets? Have you made any additional calculations or analyzed some definite test passes?

We cannot predict future when trading. Therefore, I performed test passes on historical data, analyzed various couples and triplets, examined their balance curves, profitability, drawdown and margin usage.

The obtained result has been most suitable for the test period of the current strategy. All possibilities for symbol selection and combining are embedded in settings and should be checked and corrected regularly, of course.

I don't call it a fitting – that is an analysis of various symbols' (or their combinations') behavior according to some definite strategy. The periodicity of corrections depends on deals history.

After the Championship has started, I recalled the method described and analyzed by Dmitriy Skub from the article Controlling the Slope of Balance Curve During Work of an Expert Advisor. This has been implemented to FF532 Expert Advisor which can now be found in Signals service. Quite an interesting thing to examine! The balance curve is the best way to know about deal's success or failure, as well as to decide whether some changes should be implemented in the strategy.

Did you have any difficulties during the registration with 30 minutes limit for the automatic tests?

Yes, like I've said already, there were some difficulties - enumerations, arrays, loops, etc. And constantly incoming ticks, of course. 30 minutes? I don't know what is the most efficient time interval. May be one hour? Two? However, I can understand you - calculating capacities are limited for testing such a monsters every hour.

I can't say for sure, as my PDA is not so fast. I performed tests in "1 minute OHLC mode". No trailing in most cases. But the ticks were coming constantly. I have even consumed the whole spare amount of calculating resources of another PC in MQL5 Cloud. ;) And I haven't mentioned working with indicators and history analysis yet.

I don't know the correct time limit to be set for the Championship. It is possible to add some new symbols and various strategies, like you've said. That will enhance the field for experiments, as well as the possibilities for Expert Advisors' analysis.

How much time did it take to test your Championship Expert Advisor? Did you have to remove something to comply with the limit of 30 minutes?

I've just had a look in my Profile. It took 20 minutes. However, I had to remove some symbols and filters at other (elder) time frames.

Do you analyze the operation of other Championship multicurrency Expert Advisors? Do they inspire you for some new ideas?

No, I don't. Just have some glimpses when I can. I'm fully focused on my own trading robot, as I'm constantly thinking about possible future improvements.

However, I try to read articles on MQL5 web site, as well as Championship news and comments. So, I'm a fan of my own Expert Advisor and I hope it will be in TOP-3.

Suppose that you have found a strategy and want to use it at various symbols. How difficult is it to turn a simple strategy for one symbol into a multi-currency trading robot? What can be of help in that case?

Well, to be brief, it's not so difficult. You just need some devotion. I used an array of symbols, enumerated them only in Init() sending the indicator, which reported on entry/exit signals at other symbols, to each chart. Also, trading functions with checks have been used.

It is quite possible to use even the Standard Library. Quite cumbersome, of course, but it will be provided with all necessary checks and messages.

MQL5 web site, including Forum, Code Base, documentation, articles and Standard Library were extremely helpful, not to mention about programming languages, constantly developing MetaTrader 5 and MQL5, Championship account for tests (its network environment settings), Tester operation modes and your own ideas about the market, of course.

Thank you for your detailed answers, Alexandr. We wish good luck to you and your Expert Advisor! 

Let me also thank you for the opportunity to share my views with the Championship participants and spectators. I'm waiting for critical comments. ;)

I would also like to wish all the Participants good luck in their future trading activity, as well as success in all fields!

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

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.

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.

How to create an indicator of non-standard charts for MetaTrader Market How to create an indicator of non-standard charts for MetaTrader Market

Through offline charts, programming in MQL4, and reasonable willingness, you can get a variety of chart types: "Point & Figure", "Renko", "Kagi", "Range bars", equivolume charts, etc. In this article, we will show how this can be achieved without using DLL, and therefore such "two-for-one" indicators can be published and purchased from the Market.