How to program EA

I am not new to computer programming, but I was wondering where there is a good source of information for learning how to use make your own script for EA. I’ve used C and C++ as well as some other not so popular languages.

Try Interactive Brokers. They have an API. You can also join the TWSAPI yahoo group for samples.

That said though, there are other companies that have already spent years and millions of dollars to create robotic trading systems that you can just use and save yourself years and a lot of money. I use the cooltrade system and they are already connected to numerous brokers and do not require any programming to use them.

Keith

MQL4 Tutorial
that’s what you need.

thanks for the tip

Someone named CodersGuru wrote a very good PDF about how to program EA’s (i think you can find it using google). If you have knowledge of C programming you’ll find it easy.

CodersGuru is the best !

many of us learn coding from his site and his manual.

The guy disapear from the net a few month ago, but his work are still there.

Learn there, you will see it is simple !

I’m still here! :cool:
And I’ll start soon writing MQL5 tutorial. And it will be FREE as usual

hi codersguru.~

why don´t you start a thread here teaching how to program mql4.

it would be very apreciate

It’s a good idea! But I have to finish rewriting my lessons before.
Mql5 too is coming (very slowly) but it will replace the MQL4 soon.

Here’s a decent starting point till codeguru switches to MT5 - MQL4 Tutorial

I learned mql4 mostly from that book and from articles on the mql4 website

But you had some programming background right?

If you can code C, java or any other language, no problems with mq4. I did not even need a book. It is all included in the MT Editor. Every api call is documented very well. It took exactly one day since start until my very first (and humble) EA got running. You can code an EA with as little as 10 lines of code or less, which opens orders and closes them. Not to say that would be profitable. Just to learn how to code the basic stuff.

Just an example. Took me less than an hour from scratch, backtest included. DON’T USE THAT EA with real money! An EA which buys on oversold RSI and sells on overbought RSI:

int Ticket=0; // init variable orderticket

int start() // new tick starts this call!
{
if (iRSI(NULL,60,14,PRICE_CLOSE,0) <30 && Ticket ==0) // if rsi tf 60 oversold + no trade active
Ticket = OrderSend(Symbol(),OP_BUY,1,Ask,3,Ask-0.01,Ask+0.01); // buy 1 lot 3 slip, sl, tp=100 pip
if (iRSI(NULL,60,14,PRICE_CLOSE,0) >70 && Ticket !=0) // if rsi overbought + trade open
{
OrderClose(Ticket,1,Bid,3); // close order slippage 3, lot 1
Ticket=0; // reset ticket
}
return(0); // return to listener for new ticks …
}

There ya go: :smiley:


Not really, I pretty much had to learn from scratch.
I had dabbled a little bit with other programming languages in the past but never enough to really create my own programs, just enough to be able to find existing code that nearly did what I wanted and modify it a little.