Newbie / Learning - # and ; - page 2

 
Alain Verleyen:
Just a comment about your edit2. It's not an opinion, it has been announced by Metaquotes : there will not be new development on MT4/mql4.
Thank you for the confirmation! I did not know that!
 
dcmb:

Hi all,

I'm very new to MQL4 and have no C or C++ knowledge. I do know a fair bit of VBA.

I have 2 questions on MQL4:

1) What is # used for? I saw some examples and it seemed like comments to me. Is it the same as //?

2) Does all codes in MQL4 ends with ;? (semicolon).


Thanks in advance!


I would suggest you: take an existing EA (there are two coming with the installation or dld one from the code base) and try to add another indicator as additional filter.

If you have a problem don't ask here in the forum first - you'll find an answer a lot faster if you:

  1. Use the help (F1, mark a mql4 function + F1, F1+Index-tab Search keyword, ..) of the editor.
  2. Use the debugger: editor => Debug .. use enums instead of #defines as the debugger still can't deal with #defines :(
  3. Use either Comment(..) or Print(..) to see the values of the variables.
  4. Check the error number (_LastError) to find the root of the problem.
  5. Google! I assume that most of the problem you'll have other have had too and already solved them.
  6. Try to avoid graphical objects as trade trigger, use buffer or varaibales. Objects slow down the performance and the tester don't 'like' them.
  7. If you ask in the forum provide detailed information like what I did, expect, and got, the error number, code snippets, ...

Good luck!

PS: Before you start writing google for your trading idea! There practically nothing that has not been already coded for mt4.

For example if you type in the search field (index-tab) # you'll see several entries like #define and the headline of the top tells you: Language Basics / Preprocessor / ...

And abot the ;  just look via the content-tab look "Expressions" - there is your answer!

 
Fernando Carreiro:

But you have not given an alternative answer or suggestion so as to how to motivate users to learn the principals and basic coding skills, instead of being fixated on "making money". In the end they are not being able to accomplish either of the two goals - they neither learn the MQL language properly nor do they "make money" (which also has its basic principles and skills that need be learned separately as well, and why I send them off to "BabyPips School of Pipsology").

Yes I did.

The resources on mql available on this site (and mql4.com including the Book, even outdated) are sufficient enough.

Anyway, with this topic, they have several opinions and that's good.
 

I think you both make some excellent points.

Alain Verleyen:

I really don't understand Fernando or your recommendations to learn C.

While I merely intended to add an excellent source to Fernando's list because I recently saw it (rather than advocate the OP study C) I do also see Fernando's point about where to start for a complete novice.

That being said, I also agree with Alain that spending a lot of time getting your head around irrelevant material is not time well spent, particularly if someone only has a limited amount of time to spend learning new things.

My advice to the OP is to move straight to MQL5. Much of the code is compatible with MQL4 now and the MQL5 Help as One File is actually quite good.

If you struggle to understand concepts like OOP, pointers, arrays etc. from the MQL sources, look it up in a more popular language (C/C++ are the obvious ones). There is almost certainly a suitably-pitched explanation of what you want somewhere on the internet, but it might not be in MQL.

 
Alain Verleyen:

Seriously, it would interesting to have some feedbacks from people who start learning mql without previous programming knowledge. 

As is probably painfully obvious from my posts, I completely lack any formal education in anything relating to programming.

I have taken a meandering route from HTML > MQL > VBA > SQL > C > C++ > Javascript > Python, all of it using free sources on the internet.

When I started with MQL, I didn't understand anything (some might say I still don't!). I mostly learned MQL the way Carl described. It was the most effective way to achieve my goal at that time: to code up my epic ideas and strategies! (guess how that turned out)

If I did it again, I would start with learning the very basic concepts of programming in a related language (what is a variable? what is a function? etc.) simply because there isn't a source of material at that level relating to MQL that I am aware of.

As soon as I had grasped the basics, I'd move on to MQL5 and reference back to other languages when needed.

Hindsight is a wonderful thing. 

 

I learned mql4 with no knowledge of any other programming language.

Although I have no doubt that knowing C++ would be an advantage, it is not necessary.

I have since tried to learn a bit about C++ but I have not been successful.

If I had thought that it is a requirement to know C++ before learning mql4, I would probably have given up!


I wish that I could learn C++ as it would mean that I could probably use the libraries that come with MT4. As it is, I cannot create something like a drop down combo box using the mqh because I have no idea how to integrate it into my code. So I code the drop downs as separate edit boxes or labels from an array when it is required.

 

Thanks all for your suggestions and opinions.

Very appreciated :)

 

Forum on trading, automated trading systems and testing trading strategies

Newbie / Learning - # and ;

Carl Schreiber, 2016.12.11 21:42


I would suggest you: take an existing EA (there are two coming with the installation or dld one from the code base) and try to add another indicator as additional filter.

If you have a problem don't ask here in the forum first - you'll find an answer a lot faster if you:

  1. Use the help (F1, mark a mql4 function + F1, F1+Index-tab Search keyword, ..) of the editor.
  2. Use the debugger: editor => Debug .. use enums instead of #defines as the debugger still can't deal with #defines :(
  3. Use either Comment(..) or Print(..) to see the values of the variables.
  4. Check the error number (_LastError) to find the root of the problem.
  5. Google! I assume that most of the problem you'll have other have had too and already solved them.
  6. Try to avoid graphical objects as trade trigger, use buffer or varaibales. Objects slow down the performance and the tester don't 'like' them.
  7. If you ask in the forum provide detailed information like what I did, expect, and got, the error number, code snippets, ...

Good luck!

PS: Before you start writing google for your trading idea! There practically nothing that has not been already coded for mt4.

For example if you type in the search field (index-tab) # you'll see several entries like #define and the headline of the top tells you: Language Basics / Preprocessor / ...

And abot the ;  just look via the content-tab look "Expressions" - there is your answer

Thanks so much for these info Carl.

Cheers!

Newbie / Learning - # and ;
Newbie / Learning - # and ;
  • www.mql5.com
Hi all, I'm very new to MQL4 and have no C or C++ knowledge. I do know a fair bit of VBA. I have 2 questions on MQL4: 1) What is # used for...