I want to learn how to program an EA on MT4. I have had programming experience. Namely: C/C++, MATLAB (for all you engineers out there), html, and whatever TI uses on their calculators :).
It is my understanding that C++ is the language used. I actually have an engineering buddy that is a software engineer and is very capable with assisting me, although I would like to do most if not all on my own.
I have looked online, but I can’t seem to find any good sources for a starting point. Can somebody point me in the right direction?
If you are looking for something the equivalent of MicroSofts learning center, you are not going to find it. The best place to start with is MQL4.com. They have complete documentation, tutorials and lots of coding samples. However the site is written in a language that I would call Russlish and the method of presentation is definitely foreign to most westerners like myself.
Still if you have strong programming skills and a basic understanding of C, you should be able to cope.
I basically started from scratch with no programming experience a couple months ago and have made decent progress. My work sent me to a MATLAB course this week so that helps. The syntax is pretty intuitive. Look for the CodersGuru guide, it includes a simple MA crossover EA, an indicator, and a script with a walkthrough. You’ll be just fine.
I wouldnt start trying to program an EA untill I already developed a good working and profitable strategy by regular trading then try to write an EA to auto trade it.
I agree with SDC, you need to know what you want to program before you start. It’s easy to lose track of your goal when you start writing code.
That being said, I’m running into an issue. I never want my program to open multiple trades on a single bar. I limited it to only one trade at a time, but if that trade t/p’s or s/l’s, it is still able to open another trade. I thought something like this would work…
int openID
//opening order processes, one requirement is openID!=Open[0]
//if order is opened
Print("BUY order opened : ",OrderOpenPrice());
openID=Open[0];
This is all in the expert start section. Could someone please explain why this does not work?
Also, if there is an easier way to do this please let me know.
Disregard, figured out my own problem. I was storing openID as an integer. When it compares to Open[0] (a double) it will be different virtually all the time. When I make openID a double, it works as expected.
I guess I can only stress checking your data types.