lots of resources on this site.
please take time to use search box top right every site page.
also notice top of page the link: Book
and
'Could someone please suggest me where to begin with the MQL4 ?'
I'm new to automated programming and i'm currently trying to choose between 4 candidate platforms. Before I start investing time in reading books and manuals, I'd like to see how complicated is to write code. One of the companies responded same day with the complete code for the example I presented. I work in marketing and I don't think it's a good idea to tell to a prospective customer to go read the manual or find himself the answers to his questions.
Jim
I'm new to automated programming and i'm currently trying to choose between 4 candidate platforms. Before I start investing time in reading books and manuals, I'd like to see how complicated is to write code. One of the companies responded same day with the complete code for the example I presented. I work in marketing and I don't think it's a good idea to tell to a prospective customer to go read the manual or find himself the answers to his questions.
Jim
Hi Jim,
This is a user's forum. We don't represent MetaQuotes so we're no going to pretty it up for you. It sounds like you're in the wrong place here if you're expecting a call-back from sales.
If you have specific questions that are not too difficult to answer then you can usually get that kind of help here - otherwise, what you got from fbj is pretty much the way it is.
There may be other people on this forum who have the time to help you out with your EA question, but I personally can't right now. keep watching the thread for a while - maybe someone else will jump in and offer up some assistance.
- Tovan
I downloaded MT 4 and it looks like a mountain to climb to learn how to write EAs. Is there a good manual of the language with examples? If someone has time, what is the complete EA look like to backtest a very simple system like:
-----
condition: close of this bar > close of previous bar
If condition then buy the open of next bar
limit order at entry price + 10 pips
stoploss order at entry price - 10 pips
-----
Thanks
Jim the trader I'm just as lost as you...i downloaded one manual that was supposed to be the simple way of breaking into the language...2 minutes of trying to read,it felt like i was reading "7 books of Moses" and about to run mad....can't there be a way we newbies can also learn this thing?
Hello,
I hate to see noobs get discouraged :). So, here are some resources that started to got me going about 1 year ago.
1. There's good tutorial for beginners at metatrader.info
2. You can download a lot of good indicators & scripts at forex-tsd, great forum support and also good threads for code learning. Also MT4 navigational tips by hanover and MQL Guide by RickD in forex factory.
3. Skip most chapters of MQL4 Book & Documentation until you have good grasp of data type, functions, expression, logical, conditional, loop, etc from no.1 tutorial. I agree MQL4 Book can give non-programmer a lot of head-scratching :).
4. Instead refer a lot to the attached MQL4 Reference Guide which IMO is the most important reading, try to combine it with MetaEditor & MetaTrader Help.
5. Each Broker has different rules and trading conditions that in the end will effect how you code your strategy. So make sure you understand that and read Programming of Trade Operations chapter in MQL4 Book which I guess is the second most important reading (that chapter in particular). A lot of program-result failure (not from coding mistakes) can be avoided if you have your trading logic in alignment with trading operation rules mentioned there.
If/when you get by the above 5 and still intend to learn MQL4, the following advice may be useful :)
6. Start with modifying scripts or Indicators parameters. Add and change one parameter at a time and compile/relaunch MT4 at each change to see the difference you made, and progress from that. Save EAs for later..
8. You will encounter many errors caused by missing semicolons ';' and unmatched parenthesis ')' and or bracket '}' and mistaken '=' for '==' .
So, please :
- Don't forget to put ';', each line of code command needs it. It's like a period in a sentence.
- Make a habit of a good code-writing style that can easily match braces & parenthesis. Look for that particular kind of style in good Indies or EA's (the neatly indented ones, see if you can align or match braces and 'ifs' easily) and make it your own. Or...
- When you progress to coding or editing lots of nested 'if' (that is conditional-if inside conditional-if and so on) copy and paste the whole code to a dedicated code-writing program like notepad++ (google for free download), it has matching braces feature. Paste back to MetaEditor to recompile.
Some tips :
9. If you can pronounce your code mentally, you'll have a greater chance of more comprehension. It's also to differentiate & avoid mistakes.
Example : (for assignment symbols) read '=' as 'is' or 'is now' and (for relational symbols) '==' as 'is equal' and (for logical) '&&' as 'and and'
and '&|' as 'and or', etc.
10. Lastly is algorithm, this is the real work, this one you gain by experience. IMHO algorithm is the implicit solution. You can only learn this by figuring out how a piece of program works and the purpose of it. Coders may not tell you this, but this is the one that gets you hooked !! The satisfaction of understanding or writing a certain loop function, finding a more elegant approach or coming up with your own algo solution can be very rewarding if not addictive!
I'm not a millionaire trader (yet:)) & am not an expert coder or something...I still consider myself new in coding & trading. This is just my 2 bit of experience in using what I think is the greatest program for trading....
So... HTH and maybe in the near future I can ask you to make me a holy grail EA...:) for now I'm off to make me thousands of demo pips...LOL
Best of Luck
Evan
Hello,
I hate to see noobs get discouraged :). So, here are some resources that started to got me going about 1 year ago.
1. There's good tutorial for beginners at metatrader.info
2. You can download a lot of good indicators & scripts at forex-tsd, great forum support and also good threads for code learning. Also MT4 navigational tips by hanover and MQL Guide by RickD in forex factory.
3. Skip most chapters of MQL4 Book & Documentation until you have good grasp of data type, functions, expression, logical, conditional, loop, etc from no.1 tutorial. I agree MQL4 Book can give non-programmer a lot of head-scratching :).
4. Instead refer a lot to the attached MQL4 Reference Guide which IMO is the most important reading, try to combine it with MetaEditor & MetaTrader Help.
5. Each Broker has different rules and trading conditions that in the end will effect how you code your strategy. So make sure you understand that and read Programming of Trade Operations chapter in MQL4 Book which I guess is the second most important reading (that chapter in particular). A lot of program-result failure (not from coding mistakes) can be avoided if you have your trading logic in alignment with trading operation rules mentioned there.
If/when you get by the above 5 and still intend to learn MQL4, the following advice may be useful :)
6. Start with modifying scripts or Indicators parameters. Add and change one parameter at a time and compile/relaunch MT4 at each change to see the difference you made, and progress from that. Save EAs for later..
8. You will encounter many errors caused by missing semicolons ';' and unmatched parenthesis ')' and or bracket '}' and mistaken '=' for '==' .
So, please :
- Don't forget to put ';', each line of code command needs it. It's like a period in a sentence.
- Make a habit of a good code-writing style that can easily match braces & parenthesis. Look for that particular kind of style in good Indies or EA's (the neatly indented ones, see if you can align or match braces and 'ifs' easily) and make it your own. Or...
- When you progress to coding or editing lots of nested 'if' (that is conditional-if inside conditional-if and so on) copy and paste the whole code to a dedicated code-writing program like notepad++ (google for free download), it has matching braces feature. Paste back to MetaEditor to recompile.
Some tips :
9. If you can pronounce your code mentally, you'll have a greater chance of more comprehension. It's also to differentiate & avoid mistakes.
Example : (for assignment symbols) read '=' as 'is' or 'is now' and (for relational symbols) '==' as 'is equal' and (for logical) '&&' as 'and and'
and '&|' as 'and or', etc.
10. Lastly is algorithm, this is the real work, this one you gain by experience. IMHO algorithm is the implicit solution. You can only learn this by figuring out how a piece of program works and the purpose of it. Coders may not tell you this, but this is the one that gets you hooked !! The satisfaction of understanding or writing a certain loop function, finding a more elegant approach or coming up with your own algo solution can be very rewarding if not addictive!
I'm not a millionaire trader (yet:)) & am not an expert coder or something...I still consider myself new in coding & trading. This is just my 2 bit of experience in using what I think is the greatest program for trading....
So... HTH and maybe in the near future I can ask you to make me a holy grail EA...:) for now I'm off to make me thousands of demo pips...LOL
Best of Luck
Evan
cameofx, excellant post. I first encountered the MetaTrader platform and MQL4 two years ago and you have documented a learning process that nearly mirrors my experience in learning MQL4 with the exception of the Notepad++ suggestion. Thank you for that suggestion --- as a result of your suggestion I found the http://sourceforge.net/ website which is home for Notepad++, however, I found their website too confusing and checked www.download.com for Notepad++ and found it there.
Definately working with nested "if" operators is one of the more challenging aspects in working with MQL4 --- hopefully Notepad++ makes that aspect easier to master. What I find to be challenging with the indentation process of matching braces is when they are separated by 300 to 400 lines of code. When that occurs it is very difficult to confirm which brace is correct when it is way off the screen. As an aid to resolving the nesting nightmare, I have resorted to the following:
1) Whenever I have a nested "if" operator I assign it a "code block" number and place that entire sequence of code in a separate text file.
2) When all of "code blocks" are finished I assemble the EA code in Excel (in a single column --- not multiple columns, although you could do that to implement the suggested indentation) and color code the cell background for each "code block" --- that way if the braces are separated by several hundred lines of code, I can easily find the end of that section. Color coding each "code block" is key!
3) When the desired EA code is assembled copy it from Excel and paste into the MetaEditor.
I should note, that earlier in the process when I am first creating the code for a "code block" I create it in a text editor,and paste a few lines at a time into the MetaEditor and compile it before adding any more code to the MetaEditor, that way the quantity of errors is keep to a minimum at each compilation and the source for those errors is kept to a small area. Definately forgetting to insert a ";" at the end of an operator creates havoc --- one missed semicolon can generate several errors messages, so keeping each compilation step to a few lines at a time really helps in the beginning. When I complete each "code block" I then copy and paste and save it in a text file for assembly in Excel as noted above.
regards,
Hello,
I downloaded MT 4 and it looks like a mountain to climb to learn how to write EAs. Is there a good manual of the language with examples? If someone has time, what is the complete EA look like to backtest a very simple system like:
Expert Advisor Programming see: 'New MQL4 Book' by Andrew R. Young.
The original is hard copy and now there is a downloadable eBook which has the advantage of being able to search it
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I downloaded MT 4 and it looks like a mountain to climb to learn how to write EAs. Is there a good manual of the language with examples? If someone has time, what is the complete EA look like to backtest a very simple system like:
-----
condition: close of this bar > close of previous bar
If condition then buy the open of next bar
limit order at entry price + 10 pips
stoploss order at entry price - 10 pips
-----
Thanks