Discussion of article "MQL5 — You too can become a master of this language"

 

New article MQL5 — You too can become a master of this language has been published:

This article will be a kind of interview with myself, in which I will tell you how I took my first steps in the MQL5 language. I will show you how you can become a great MQL5 programmer. I will explain the necessary bases for you to achieve this feat. The only prerequisite is a willingness to learn.

Many people think that since I already know how to program in C/C++, I immediately started with complicated and elaborate projects in MQL5. I wish I could say that this is how it all started. However, the reality turned out to be quite different.

Whenever we take the first steps in developing our own solutions, we often start with what we think we already know. In my case, when I started to use MQL5, all I had at hand was the language documentation. I didn't even know there was a community dedicated to helping other interested programmers.


This is something extremely basic. But being able to create this code in a completely autonomous way, without anyone's help, except for documentation and source codes from MetaEditor, showed me that I can do something else. All I had to do was to adapt my existing knowledge of C and C++ to MQL5. This is where things really started to progress.

Author: Daniel Jose

 
I'm just going to give my humble opinion.
Metatrader is a Forex application. Not a program to interact with WebGL or DirectX. If you want to make a window application I look up Visual C++, Visual Studio. If I want an animation application I look for Unity.
I prefer the simplicity of MQL4. So easy it was to load an indicator in "Old" MQL4. I never really missed those M2 M3 (m3, seriously) time frames.
What MQL5 is really good at is access to historical data for optimization.
 
Great article. Thanks...
 

I am going myself through the journey right now, so below I give some brief notes on the topic of the article from the point of view of a trader who wants to trade the financial markets with Metatrader using own algos. Keep in mind trader's primary goal is trading, while software engineer's is programming.

1. The biggest obstacle will be wading through the mud of irrelevance that nowadays has made internet learning into a real swamp. Finding good sources will consume more time and effort than learning from the right ones once you find them. 

2. There is no good low cost source to learn MQL, to the best of my knowledge.  Udemy courses are not all that great (speaking from experience), only worth buying when they are deeply discounted (10 euros or below). Youtube videos: there are some channels that are pretty good - if you are looking for specific things. A few give you just the very basics. None post a systematic course that teaches you all you need to know, not for free. Most of the free good videos are usually a marketing funnel into the paid courses. Nothing wrong with that, just something you need to be aware of. I cannot comment on the paid courses, never done any.

3. In software engineering at large, MQL simply does not exist. There is a book or two, those teach the language in its entirety. They are written for programmers, not traders.  Hence, learning all that will consume many months if not years of your time even if you have the patience and the time. Time that you could be spending trading. The actual subset of knowledge that is necessary to make your own EAs and Indicators that are sophisticated enough to be trusted on your own live accounts is considerably smaller. A lot of things are simply not necessary for own use codes. If you want to freelance or sell prepackaged MQL codes, you need to master a bigger deal of the laguage, of course.  A side note: even if you are a trader, it might be worth spending time and effort to learn general software engineering (in one of the big laguages like C++ or C#, but not MQL) on the side. If you blow your account, making money as a coder may allow you to avoid starvation and slowly build capital to go in the game again. 

4. MQL Reference set of pages on this website is a reference not a text book. It is invaluable to know the inside and out of specific MQL language elements. It is a nightmare to study from (I know, I tried).

5. The best in my opinion is to learn the basics with C++. There are many excellent courses on C++ for very low cost or free.  C# or Java (NOT JavaScript, JS is like Python but worse!) are also suitable, even if a bit more remote. Also, in my opinion it is not beneficial to learn C. In 2023, C is a niche langauge for systems programming (OS, drivers, etc). C++ incorporates all of the classic C you need. 

6. MQL core functionality is practically C++. To the basic language, a whole bunch of enumerations, built-in functions and classes that are specific for trading on MT platform is added. Those trade-specific elements do not exist in C++, of course. Once you know how variables, constants, data types, functions and objects behave in general in C++, it is very easy to get those additional specific MQL elements. You need to learn OOP enough to know what it is, what it does, and how to use objects from the  built-in  MT library classes in your procedural codes alongside functions. Using available classes is much easier than programming your own classes, creating libraries, manage tens or hundreds of header (.mqh) files, etc. Programming your own OOP is like building a multinational car manufacturer company just to build a single car, so you can drive from home to work everyday.

7. Forget Python. I can write pages about it, but just take my word for it. Python simplifies some things, creates complications in others. Python's real problem is that it has too much freedom. The rigid syntax of C++, the static types and above all Sergeant Compilator in the end result in codes that are very unambiguous and reliable. The freedom of Python is often the freedom to go in the water and drown yourself. The 'difficulties' of learning C++ are more of a myth than reality. Consider this:  C++'s {} and ; are replaced in Python by : and mandatory indentation, in the end the effort ends up about the same.  You do not need to learn the whole of C++ to master MQL5 anyway. I learned Python all the way to OOP, then realized after 16 months I was still at the 0 point of my journey as an algo programmer, then relearned C++ (I forgot about 99% of the C++ course I took as a STEM undergraduate student almost 30 years ago). Thereafter I was able to write usable MQL5 EAs and indicators. 

6. In many ways MQL5 is closer to C++ than MQL4. That results in many things being more difficult in MQL5 than MQL4. Still, in 2023, it is not recommended for people who are nnow starting out to learn MQL4. MQL4 is kept alive by its installed user base from the times when it was current. Even if both languages were equal, MT5 comes with a superior backtester and the ability to download a standalone MT platform with never expiring, non-broker-affiliated demo account to play at your heart's content. If you need, it is easy to translate your MQL5 EAs backwards to MQL4 once you master MQL5. Indicators take a bit more effort, still quite doable.

7. So here is the learning path that worked for me:

- Learn programming basics with a general programming language, easiest with C++ because it is the closest to MQL. All programming cources teach the basics with simple console programs. MetaEditor does not have a console. Printing "Helllo World!" in the Terminal Journal is far inferieor experience than directly on a console with "cout >>". You can interact with an MQL code only indirectly through the input parameters, not in real time through "cin >>".

- Once you have mastered the programming basics, go to youtube and find videos that go step by step on building a whole working EA or indicator (there are plenty at time of writing). First, watch the whole video, most efficiently by turning off the sound, on the subtitles and speeding up to 1.5x or 2x to grasp the content. Then, watch again and type the code along, pausing the video and rewinding if you need, with sound on.

- Don't take more programming courses - just code code code, backtect backtest backtest.  Unfortunately, MQL does not offer unit testing facility (indispensible for proper software engineering), but with some creativity you can develop your own ways to use the backtester for that. Watch more videos on specific topics when you need. Articles/posts on this website can be equally helpful. Hit F1 in MetaEditor as often as you need. Hit it even if you don't, just to learn something new or polish what you already learned eveyday. 

 
Eric A. Kantchev # :

Eu mesmo estou passando pela jornada agora, então abaixo eu dou algumas breves notas sobre o tópico do artigo do ponto de vista de um trader que deseja negociar nos mercados financeiros com o Metatrader usando algoritmos próprios. Tenha em mente que o objetivo principal do trader é negociar, enquanto o do engenheiro de software é programar.

1. O maior obstáculo será caminhar na lama da irrelevância que hoje em dia transforma o aprendizado pela internet em um verdadeiro pântano. Encontrar boas fontes consumirá mais tempo e esforço do que aprender com as fontes certas depois de encontrá-las.

2. Não existe uma boa fonte de baixo custo para aprender MQL, pelo que sei. Os cursos da Udemy não são tão bons (falando por experiência), só valem a pena comprar quando estão com grandes descontos (10 euros ou menos). Vídeos do Youtube: existem alguns canais que são muito bons - se você estiver procurando por coisas específicas. Alguns fornecem apenas o básico. Nenhum publica um curso sistemático que ensine tudo o que você precisa saber, não de graça. A maioria dos bons vídeos gratuitos geralmente é um funil de marketing para os cursos pagos. Nada de errado com isso, apenas algo que você precisa estar ciente. Não posso opinar sobre os cursos pagos, nunca fiz nenhum.

3. Na engenharia de software em geral, MQL simplesmente não existe. Há um livro ou dois, que ensinam o idioma em sua totalidade. Eles são escritos para programadores, não para traders.   Portanto, aprender tudo isso consumirá muitos meses, senão anos, do seu tempo, mesmo que você tenha paciência e tempo. Tempo que você poderia gastar negociando. O subconjunto real de conhecimento necessário para criar seus próprios EAs e indicadores sofisticados o suficiente para serem confiáveis em suas próprias contas ativas é consideravelmente menor. Muitas coisas simplesmente não são necessárias para códigos de uso próprio. Se você deseja trabalhar como freelancer ou vender códigos MQL pré-empacotados, é claro que precisa dominar muito a linguagem. Uma nota lateral: mesmo se você for um comerciante, pode valer a pena gastar tempo e esforço para aprender engenharia de software geral (em uma das grandes linguagens como C++ ou C#, mas não MQL) paralelamente. Se você explodir sua conta, ganhar dinheiro como programador pode permitir que você evite a fome e lentamente acumule capital para entrar no jogo novamente.  

4. O conjunto de páginas de referência MQL neste site é uma referência, não um livro de texto. É inestimável conhecer o interior e o exterior de elementos específicos da linguagem MQL. É um pesadelo estudar (eu sei, eu tentei).

5. O melhor na minha opinião é aprender o básico com C++. Existem muitos cursos excelentes em C++ por um custo muito baixo ou gratuitos.   C # ou Java (NÃO JavaScript, JS é como Python, mas pior!) Também são adequados, mesmo que um pouco mais remotos. Além disso, na minha opinião, não é benéfico aprender C. Em 2023, C é uma linguagem de nicho para programação de sistemas (SO, drivers, etc). C++ incorpora todo o C clássico que você precisa.

6. A funcionalidade principal do MQL é praticamente C++. À linguagem básica, é adicionado um monte de enumerações, funções internas e classes específicas para negociação na plataforma MT. Esses elementos específicos do comércio não existem em C++, é claro. Depois de saber como variáveis, constantes, tipos de dados, funções e objetos se comportam em geral em C++, é muito fácil obter esses elementos MQL específicos adicionais. Você precisa aprender OOP o suficiente para saber o que é, o que faz e como usar objetos das classes de biblioteca MT integradas em seus códigos processuais juntamente com as funções. Usar classes disponíveis é muito mais fácil do que programar suas próprias classes, criar bibliotecas, gerenciar dezenas ou centenas de arquivos header (.mqh), etc. pode dirigir de casa para o trabalho todos os dias.

7. Esqueça o Python. Posso escrever páginas sobre isso, mas aceite minha palavra. Python simplifica algumas coisas, cria complicações em outras. O verdadeiro problema do Python é que ele tem muita liberdade. A sintaxe rígida do C++, os tipos estáticos e, acima de tudo, o Sergeant Compilator no final resultam em códigos muito inequívocos e confiáveis. A liberdade de Python geralmente é a liberdade de entrar na água e se afogar. As 'dificuldades' de aprender C++ são mais um mito do que realidade. Considere isto: {} e ; são substituídos em Python por : e recuo obrigatório, no final o esforço acaba sendo o mesmo.   Você não precisa aprender todo o C++ para dominar o MQL5 de qualquer maneira. Aprendi Python até OOP e, depois de 16 meses, percebi que ainda estava no ponto 0 de minha jornada como programador de algo, depois reaprendi C++ (esqueci cerca de 99% do curso de C++ que fiz como aluno de graduação STEM quase 30 anos atrás). Depois disso, consegui escrever EAs e indicadores MQL5 utilizáveis.

6. De muitas maneiras, o MQL5 está mais próximo do C++ do que do MQL4. Isso resulta em muitas coisas sendo mais difíceis em MQL5 do que em MQL4. Ainda assim, em 2023, não é recomendado para pessoas que estão começando a aprender MQL4. O MQL4 é mantido vivo por sua base de usuários instalada desde os tempos em que era atual. Mesmo que ambos os idiomas sejam iguais, o MT5 vem com um backtester superior e a capacidade de baixar uma plataforma MT independente com uma conta demo nunca expirada e não afiliada ao corretor para jogar o quanto quiser. Se você precisar, é fácil traduzir seus EAs MQL5 de volta para MQL4 depois de dominar o MQL5. Os indicadores exigem um pouco mais de esforço, ainda bastante factíveis.

7. Aqui está o caminho de aprendizado que funcionou para mim:

- Aprenda o básico de programação com uma linguagem de programação geral, mais fácil com C++ porque é o mais próximo do MQL. Todos os cursos de programação ensinam o básico com programas de console simples. O MetaEditor não possui um console. Imprimindo "Olá, Mundo!" no Terminal Journal é uma experiência muito inferior do que diretamente em um console com "cout >>". Você pode interagir com um código MQL apenas indiretamente por meio dos parâmetros de entrada, não em tempo real por meio de "cin >>".

- Depois de dominar os fundamentos da programação, acesse o youtube e encontre vídeos que explicam passo a passo a construção de um EA ou indicador funcional completo (existem muitos no momento em que escrevo). Primeiro, assista ao vídeo inteiro, de forma mais eficiente desligando o som, nas legendas e acelerando para 1,5x ou 2x para apreender o conteúdo. Em seguida, assista novamente e digite o código junto, pausando o vídeo e rebobinando se precisar, com som ligado.

- Não faça mais cursos de programação - apenas codifique o código do código, backtect backtest backtest. Infelizmente, o MQL não oferece facilidade de teste de unidade (indispensável para uma engenharia de software adequada), mas com alguma criatividade você pode desenvolver suas próprias maneiras de usar o backtester para isso. Assista a mais vídeos em tópicos específicos quando você precisar. Artigos/postagens neste site podem ser igualmente úteis. Pressione F4 no MetaEditor sempre que precisar. Acerte mesmo que não, apenas para aprender algo novo ou aprimorar o que você já aprendeu todos os dias.

Thanks for the evidence. This is more or less what I wanted to write this article. Because many people who start out don't know which direction to go in and end up dropping out of studying or learning, imagining that it's something very difficult or something impractical.

Reason: