My rant about Programming EA's and Indicators

Can anyone recommend a good tutorial on mql4 I have read a couple and really getting nowhere with it, I feel like the tutorials I have found are like so many other computer language tutorials, they teach you a bunch of stuff that in no way helps you write your own program. My analogy to this is like If I could speak Chinese, I could write a tutorial explaining chinese verbs chinese nouns chinese punctuation and how they are used in the chinese language, I could take a piece of simple Chinese text and break it down and explain each line and translate it to english, after reading that could you hope to write a grammaticaly correct poem in chinese or a story?
Obviously not, and that is where I am with mql4 tutorials. I’m just not getting it, I understand what they are describing when they break down each line of a simple indicator I see what the code does and why it is as it is but I am no closer to writing my own indicator or EA than I am to writing a Shakespearian play in Chinese.

Most of what I learned was from looking over the book and forums at mql4.com

I made custom EA etc. by finding other code that did what I was after and modifying to suit my needs.

Mind you I have thrown all that out the window seeing as though candles, lines and fibs are all I use for trading.

Hi,
How much about programming in general do you know? Hoping you don’t find it insulting by my asking, but have you tried writing down …in english lol… the logic of what you want the ea to do. Logic like

  • alarm clock goes off
  • Look at time on clock
  • is it time to get up?
  • if yes then turn off alarm and get out of bed…end of process.
  • if no then reset alarm and go back to sleep and the process repeats.

I can’t recall any outstanding tutorial websites to recommend. All I knew is what I wanted the EA to do, then looked for other EA’s that were kinda close, or help online when I didn’t know how to do something. Most websites had their strengths for some things, but none I would say were comprehensive.

If you’d like any help with something, I mean I’m no expert, but I have done some programming and written a few of my own EA’s, but if I can help, I don’t mind.

:slight_smile:

Yeah I wish i could find a tutorial that told you how to do practical things like that effectively, another analogy to my previous rant is like if someone wanted to make a shelf and looked for tutorials about woodworking and they had to trawl through hundreds of texts about the anatomy of trees and their life cycle and the molecular structure of wood and all they want to know is how to saw a damn plank in half what tool to use and how to stick it to the wall, finding the relevent information on mql4 feels like a simalar task to me, how do I tell my program to look at an RSI line and do X if the line is reversing ? All i want to know is what everyone who wants to code an EA wants to know, how to tell the program to look at the indicators they use and take a values from it, trying to find in a mql4 tutorial that actually explains in practical terms how to that, I believe i will go blind first.

I have a good back ground in programming in C, so I just need to know what the mql4 functions do, take is input, and give as outputs. And I have found the library in the mql4 programming platform to by sufficient.

If I’m looking for a particular type of procedure, I can usually find parts of it in other people’s code which I find online.

A lot of learning comes from just trying things out and seeing how it works.

The only thing I would use an EA for is to automate stop orders, say on a Sunday break out for example. I would never have it actually [I]trade [/I] for me in the sense where I give it certain conditions to look for and then have it enter a trade by itself. Just too much happens in the market, and I’m still new to forex and need to put in the charting/screen time, to experience it all.

No I don’t use EA’s either except to test something out, like how many false signals a “system” will actually generate that isn’t apparent just by looking at a chart and using the F12 key to walk forward thru it.

Instead of EAs, I program indicators to alert when a particular set of conditions are met so I don’t have to stayed glued to the computer anymore.

:slight_smile:

Thanks for the offer I may well take you up on that, I really could do with some help on this. I’ll also try retreiving usable code from other EA’S and see if I can make one work that way. By the way, that reminds me, how do you retrieve values from an indicator ? I mean like how does the EA know what the indicator is called and what the values names are in the indicator for instance i read somewhere in a tutorial that mentioned bollinger bands, the name in the EA was iBands, how do we know to call it ibands in the EA code ? and how do we know what the top line in the bollinger bands is called ? Or if it was an RSI indicator how do we get values from it ? do we have to include the source code for the RSI in the EA ? or does the mql4 somehow already know what an RSI indicator is but even if it does how do we know what an RSI indicator is called in programming language ? or what the 14 period line is called ?

This may or may not help. I haven’t been through this tutorial but was going to eventually…

well I tried to upload a zip file and babypips is not cooperating. So here is a link

http://www.forexmt4.com/_MT4_Tutorials/

Thanks I’ll have a look through those too

When using MetaEditor that comes with MT4, you can use it’s reference library.

If you open any mq4 file, you can highlight any code word and press F1. That will open the reference library and locate that code word, and in the left margin you see a list of all the indicator names, (or any other code words in the same family as the one you looked up using help.)


SDC,

Unfortunately there is no easy way to learn MQL4. It is sort of like asking some-one to teach you how to write a book. You can study the language and even pass with flying colors but that does not mean there is a best seller in you…

A good way to start would be to study the tutorial offered by Coder’s Guru.

You can download the 3 zip files containing his 18 or so lesson from here…

help me find mql4 courses - MQL4 forum

The next thing you can do is start collecting a library of code snippets as pretty much anything you want to do has probably been coded before. Also code that is well commented is one of the best learning resources.

Next is to set yourself little projects to complete, even simple display exercises can teach you heaps.

As Robshan said, the MQL4 forum is an absolute wealth of information. I have been layman programming for over 20 years now, starting out with basic and moving onto VBA(basic that comes with Excel & MS Access) but I have only been using MQL4 for about 18 months now and I still face challenges every time I want to try and do something. To be quite frank, I feel totally intimidated & stupid when I try follow some of the discussions at the MQL forums.

You should also realise that you do not have to know or understand everything about coding. I still do not have much of an understanding of custom indicators and arrays are still a grey area but I know that once I need them, I will focus on them and get them taped pretty quickly.

I generally find that if I do not know how to do something, a simple search at the MQL4 forum will produce results. I often do not understand how a thing works but there is usually guidance on how to implement it in your program.

Finally, there are lots of good programmers on the various forums that relish a challenge and if you really cannot solve a problem, a simple question will yield very interesting results.

SDC it sounds like you need to cover the basics of how to define variables with integers, double, boolean etc. and how to call variables into functions and so on … If you do not understand how these work at the very least, then you will be pushing **** uphill with EA coding.

I found book.mql4.com to be quite helpful when building from the ground up… I have done some Java and C#.net programming in the past but it’s all a bit sporadic so I needed to cover the basics myself.

as Sweet Pip mentioned before, you need to define what the conditions are that need to be met and what action to take when they are met so that you can define the best course of action to develop the programming.

Thanks for all the input everyone I’m not going to quit on this so you probably havent seen the last of me posting about it. I’m going to spend some time checking out the resources and information you all posted, thanks again everyone for taking the time to reply

If you have no previous programming experience then you shouldn’t be looking for an mql4 tutorial at all. You don’t need to learn the mql4 language, you need to learn how to program. :slight_smile:

There are almost no resources for learning mql4 from scratch, but there are tons of generic programming tutorials around. Find one of them and start there.

Mql4 is based on C++. Learn it and you can program in mql4 immediately. All you need is the help file that comes with MetaEditor so you can learn the MT4 specific functions.

If you are really serious about programming for MT4 then take a class at your local community college. I had two C++ classes in college many years ago and when I started trading I picked up on mql4 immediately.

Thanks for that I had no idea that reference library was there, I see what you mean about the indicator names thats awesome I believe I may now have half a chance of creating the EA i wanted to work on

I do have some very basic previous programming experience in VB6 and I understand the logical process but not enough to sit and type out a program by myself, but I should be able to create my own EA by using other EA code as a guide especially now I know how to access the metaeditor reference library thanks again to sweetpip for that.

Then you should be all set, you just need a little practice. I can see how you’d be totally lost if you didn’t know about the reference section.

There is also a helpful navigator for it, in case you haven’t found it yet. Just hit “Ctrl-D” to turn it on.

Handy Tip - ‘static’ declared variables will store their values for the next tick each time.