Let's learn MQL4 online together

YOUR trading system could FAIL if you have an urgent appointment. That’s why most traders here want to automate their own strategy in MetaTrader!

If you cannot program in MQL4, like me, then LET’S LEARN MQL4 TOGETHER.

We need a couple of things for our own MQL4 course:

  • material: if you know any ebooks, video tutorials, relevant links and practise files, post them here
  • teacher(s): if you have experience in MQL4, please take your time to help with our questions
  • students: that’s us, let’s post as many comments and questions as possible to learn MQL4

RULES:

  • Got a question? Then write a header at the top: “QUESTION TO TEACHER”. So that teachers don’t have to read thru every single comment
  • fun: the most important thing is having FUN so that we are motivated to learn more tomorrow :44:
2 Likes

[B]QUESTION TO TEACHER:[/B]
Which ebooks, links and video tutorials are best for learning MQL4?

[B]QUESTION:[/B]
Is it best to learn C or C++ before learning MQL4? If yes, is C or C++ better?

[B]QUESTION[/B]
What online MQL course could you advise to me?

[B]QUESTION:[/B]
On what forum/blog/thread could I best ask questions regarding MQL?

Bro, I used this book and an old code to start with. Then it’s practice, practice and more practice.

For questions best heading straight to the source on the forum at mql4.com. Be tuff but, they are brutal over there and don’t understand the needs of us noobs. But they are a few who will help out.

Also the mql4 reference in metaeditor is a valued resource.

Finally they tell me C then C++ are good to learn first but then I never and I don’t think it’s necessary. Best of luck bro!

expert_advisor_programming.zip (1.41 MB)

1 Like

This is a good idea. Working and progressing as a group is often a good way to stay motivated over longer periods of time.

I have some basic and outdated dev experience. I try to upgrade my knowledge using the INTERNET, which has a metric tonne of good educational sites and programs, both free and paid, but when you’re simultaneously trying to learn how to trade, and keep solvent, it’s a bit of a juggle. I have no C or C++ and just a tiny bit of C# experience. I’m basically a newbie.

In terms of MQL resources, I’ll have to have a look around but here’s where I’d start if you have even a basic coding background. Maybe even if you don’t have that. It doesn’t hurt to start getting familiar with terminology

https://www.mql5.com/en/docs

The MetaQuotes software documentation. So here’s my goal. I’m going to read a chapter of this manual, every week. Then I’ll report back here and explain, as best I can, what I’ve learned. If I don’t, or if I"m late, please nag me and complain in this thread! Motivation!

For new coders who have very little knowledge of basics, there are a lot of options. Two I would recommend are codecademy.com and codecombat.com. Although they don’t have C++ courses, they are a fun way to learn about syntax, structures, and data types.

1 Like

https://learncodethehardway.org/c/

The ‘learn python the hard way’ book, by Zed Shaw is legendary. I think this book is in the same tradition. I’m going to check it out too.

Even more:

https://book.mql4.com/
This looks and sounds daunting.


This looks way friendlier AND it’s 87% off - not sure for how long

Also Google Jim Dandy MQL.

Just a suggestion to learning mql4… CHEAT!
You dont have to learn everything about mql4 to be able to make EA’s. Find an up to date template or existing EA that has all the functions you need. Make sure it has clear buy and sell functions.

All you really need to do to start making ea’s is to change the indicators and entry conditions. This is very easy! There is a lot of info on how to use the indicators.

eg if you want to add a stochastic indicator… just add a couple of lines of code such as

double stoch= iStochastic(NULL,0,kperiod,dperiod,slowing,MODE_SMA,0,MODE_MAIN,0);
if(stoch>stochhigh)return(1);

and add some variables such as
extern kperiod=6;
extern dperiod=3;
extern slowing=3;
stochhigh=70;

Starting by changing the indicators on an existing EA is simple enough for anybody!

I reckon this is good advice. There is lots of source code examples out there. Just find one, work through the logic and adapt to your needs.

I disagree.

I tried that but no luck.
We need to understand the basic syntax to do that.

yes, there is a bit of study to do. It is just c++ syntax.
Point about using a template is that you do not have to bother with the more tricky parts of writing an ea like oredersend and ordermodify and check trades, etc…

There is no point writing code if you dont have to. You can make an ea in 20 mins instead of a week!

I agree with both approaches. If you are starting from scratch you will probably need a basic course to understand the terms and you might need some outside help to start thinking like a programmer.

However you can also get trapped in a ‘classroom’ mentality where you try to absorb and memorize facts all the time, and coding is very much a ‘hands-on’ skill where you learn by doing. So, finding a basic template and making changes to it and then seeing how those changes affected the script are a big part of learning.

Expert Advisor Programming: Creating Automated Trading Systems in Mql for Metatrader 4 - AbeBooks
Andrew R. Young - Expert Advisor Programming in MQL for MT4


Same idea for MT5

I don’t get any kickback from these links.

This is a great thread. I am dabbling in learning to build my own EA’s. To be honest, I don’t think you can have a successful automated system unless you can tweak yourself; the market is constantly changing. Having said that, I’ve been in search for an EA that would fit my style. I finally found ‘something’. The coder pushed it out in another forum saying, “here it is, use at your own risk, I spent about 15 minutes coding this thing and I’ve not tested it” and then, poof, he was gone. Why would anyone even consider downloading something like that? Well, I guess out of desperation. But I did and surprisingly enough, it does enter at about where I would enter on a manual trade. Problem is it closes as quickly as it enters. I would like to make this thing work but I exhausted trying. I can’t even understand exactly what it’s doing but it does use all of my ‘custom’ indicators. I don’t know whether to ditch this thing and struggle with writing my own or keep trying. While we all learn MQL4 together, has anyone signed up for any of the automated writing block systems? I think I have a good one and it helps, but you still need to understand MQL4. I’ll be following this thread closely. If anyone has any suggestions on my TDI strategy (mentioned above), let me know.

Oh how I wish I knew enough to know what all of this means. I know what you’re saying, we don’t need to learn ALL there is but to do something as simple (and I think you felt it was simple) don’t we at least have to understand what it’s actually saying? Is it extern that is a whole number and double is a decimal? Now didn’t that sound pretty good (if I’m right)? But I can’t grasp it. Do they mean the price is a double? No doubt we can go far if we just bust through the confusion.

sorry… you are right…

SHould be

extern int kperiod=6;
extern int dperiod=3;
extern int slowing=3;
int stochhigh=70;

extern in front of an int, double, string, bool just makes it a changeable variable in the settings.

if you don’t understand just do a search for the function. It is all in the mql4 documentation.

You can download a template in the mql4 site too.

Rhelt -I don’t know if you’ll benefit as much from reading documentation at this stage.

In my opinion you need a basic primer so that you can get comfortable with the terminology. For complete beginners I can’t recommend a site like codecademy.com enough. It’s mostly free. It will not teach you any C but it will teach you about data types and so on.

Also check out this page. (profanity warning)
http://programming-mother****er.com/become.html

It’s a giant list of resources for learning to code. I recommend starting with the How to Think Like a Computer Scientist — How to Think Like a Computer Scientist: Learning with Python 3
Again, it’s not C (C is not the greatest first language to learn) but it will give you a framework and present the jargon in a gradual way. Use Google. Make continual progress in baby steps.

Really basic questions here:

  1. If someone gives you a file with an .ex4 extension, how can you tell if it is an indicator to be placed in the Indicators folder, or if it is an expert advisor to be placed in the Experts folder? My understanding is both file types carry the same .ex4 extension, and no source code file was provided.

  2. I have 2 instances of MT4 running on the same account, 1 on my desktop PC and 1 on the VPS. How do I synch both instances so that if I add an indicator, template or layout on the PC version, it automatically loads on the VPS version, and vice-versa? They are on the same account so I want them to be identical and a mirror image of each other.

And sorry if this is the wrong forum. I just purchased Jim Dandy’s MT4 programming course and this sounds like the proper venue for these questions.

Thanks for any guidance.

You can put an indicator in the experts folder but it will not open. It will not attach to a chart.

How do you sync your pc demo and vps account? You have to do it manually. Set it up on your demo, make sure everything is correct, then transfer it to your vps. Save the set file, etc and copy and paste. Each MT4 instance is independent. Although if you are trading the same account with different MT4 instances, the trades can be adjusted by either instance. That’s why you use magic numbers to differentiate between trading systems.

Just checked out Jim Dandy on youtube… Well i didn’t check him out as in “Check him out” just watched some of his videos. Looks interesting. Hope you learn a lot!
He has a good take on the “Fat Finger” pound conspiracy. He was saying it might be automated trading reacting to news stories and trying to move the market when it is at its weakest.
Funny thing is that the IMF has been releasing press releases about the end of the financial world. All these releases come out at the same time and are published in major papers. All very out of character and all set up to be published at the same time like these…
https://au.news.yahoo.com/world/a/32803410/all-legal-ex-imf-head-rato-says-in-embezzlement-trial/#page1
Chinese yuan now an official IMF reserve currency - ABC Rural (Australian Broadcasting Corporation)
https://au.news.yahoo.com/a/32802398/interest-rates-to-stay-low-for-longer-imf/#page1
IMF Sees Subdued Global Growth, Warns Economic Stagnation Could Fuel Protectionist Calls
http://asia.nikkei.com/Politics-Economy/Economy/Pricier-dollars-may-force-overseas-retreat-by-Japan-banks-IMF
http://www.bloomberg.com/news/articles/2016-10-05/economic-recovery-won-t-be-enough-for-25-of-banks-imf-says
http://www.afr.com/news/economy/imf-warns-on-exploding-private-debt-20161004-grv03j
http://www.marketwatch.com/story/imf-says-a-third-of-banks-in-top-countries-are-too-weak-to-survive-2016-10-05
http://www.telegraph.co.uk/business/2016/10/05/global-debt-hits-all-time-high-of-152-trillion-as-imf-warns-of-w/

So i can add to the conspiracy theory hahaha. It goes along the lines of. The lizard people want to bankrupt the UK or at least punish the UK for leaving the eu. They have decided that the Yuan will be the new dominant currency.
So selling the pound is a no brainer… But maybe look at buying the Yuan.
BTW. The lizard people have already moved out of London and have setup hq in Beijing. They already had it planned for China to be the new eccenomic capital.