where do I start to learn programming?

 

Where can I start learning how to start making programming?

 
Subgenius:

Where can I start learning how to start making programming?


start by doing. I have been programming in MQL4 for about a month and a half now (mostly part time, the odd evening when I get an hour or two), and while most of the really technical ideas (eg NN) are out of my reach at the moment (mostly because I'm not sure where to start with them), many of the basics are pretty easy.


Here's what I discovered as a newbie.


1. The examples in the docs are useful but limited, you really need to find an example of it being used in an EA to get a good feel for it.

2. Don't try and make your first EA make money, just try and get it to do what you want.

3. Start small and simple, and in steps,

3.1 Make an EA that trades on a single indicator, e.g. if MA(20) above MA(19) open a buy trade, if MA(20) below MA(19) open a sell trade

3.2 Expand that EA to use a single indicator over a time frame, e.g. if open of last MA(20) below close of last MA(19) and open of current MA(20) above close of current MA(19) then open a buy trade, i.e. if one MA crosses the other

3.3 Expand the EA with some very simple management, e.g. only open one trade at a time (I learnt this early on ;))

3.4 Expand the EA with some money management, e.g. when opening a trade check your balance, set your trade size to AccountBalance / 2000

3.5 Expand the EA to use some dynamic closing techniques, e.g. if you have a long trade open and the indicator switches to a sell indicator, close your open long trade

etc etc etc into more complex techniques, more indicators, better money management...


this kind of technique will let you learn how to program but you won't get much of an EA at the end of it, or at least you will get an average EA that might not perform as you want. I started in July doing the above and in about 2 weeks I had an EA that backtested profit for the year and has forward tested profit since the beginning of August (not much, only a couple of grand, but it's still in profit in forward test for 6 odd weeks).


Hope this helps.
 

I'd like to add to that:

4. Keep it simple and organized in separate functions. This really helps when you try upgrading the EA, keeping some parts, changing others.

Example of a simple function:


int start()

{

int i=0;

while(i<100000) {

i++;

Print("i = ",i); }

return(0);

}


Hope this helps! Just don't foget to delete log file after you've started such an EA. By the way this simple function is a complete EA - has a completed start() function, doesn't need anything else to run.

The simplest function is:

void a()

{

}

thats it xD voids don't need return function, meaning they don't need anything. They just are :)


What do I mean under keeping it organized in functions:


extern int limit=10;

int i;


int start()

{

int z=0;

while(z<limit) {

z=checki();

Print("i = ",z); }

return(0);

}


int checki()

{

i++;

return(i);

}


See? I calculation is now separated and you can edit the main calculation function as much as you like, or even replace it, without modifying anything else. This really helps me, hope these simple and useless examples help you too.

 

http://www.physics.drexel.edu/students/courses/Comp_Phys/General/C_basics//

MQL and C language are similar.

Study the above to understand the structure of MQL code. It is pretty easy.

Or google "C tutorial" for others.

 
phy:

http://www.physics.drexel.edu/students/courses/Comp_Phys/General/C_basics//

MQL and C language are similar.

Study the above to understand the structure of MQL code. It is pretty easy.

Or google "C tutorial" for others.

Excuse my newbie-ness, but...


I am not sure I agree with learning C as a good way to learn MQL if you are not a programmer, as most C tutorials delve into depths you don't really need for MQL. IMHO all you need to start is an understanding of the basic constructs and examples of syntax. While C and MQL are very similar, C can be quite confusing. If you can get your head around variables and scope, methods, loops and conditions you have pretty everything you need to start programming, then it's just MQL syntax.


I still suggest simple MQL examples and the documentation.


Just my opinion btw...

 
Fine.
 

I agree - I learned on examples myself but it really helps knowing a bit of C++ (C?). I learned C++ during my University days, and it really helped.

How to start?
Step 1. Throw away all the guides and tutorials.

Step 2. Open up Moving Average EA, it comes with MT4 by default.

Step 3. When you see a function (they're usually blue or purple, not black or grey), search for it on www.mql4.com, and you'll find definitions for those functions with examples, sometimes more.

Step 4. Study it completely and then try making something yourself.

Step 5. Study other EAs and see how they work and what they do.

Step 6. Evolve!

Step 7. Have fun repeating steps 4-6 xD

 
mazen_inj:
Where can I find MQL4.We can't learn this language without having its program.

Install MT4.

Open MetaEditor.

Have fun.


CB

 

Well If  somone can explain how to code Alert? For example code already exist but there is no alert in it...what is code structure for alert...I was looking code of  indicators with alert but I still couldnt get it...Thank you.

 

It's like this:

Alert("put text in here");

 It will send up an alert box saying:    put text in here

 You can also use a string variable:

string str1 = "this is a string variable";

Alert(str1);

 This will show:    this is a string variable

 Or you can mix them:

string str2 = "this is half a ";

Alert(str2,"sentence");

This shows:   this is half a sentence 

Reason: