Is there an instructor in the house?

 

Hello to whom it may concern,

Learning this lanugage is a challenge. A challenge of which I accept, but I sure could use some experienced

person who could lend a hand to explain a few basic steps. Once I can get the idea, I would be willing to help others.

But at this time I am so lost . It has been for four days of reading and I have not moved an inch.

I know what rules I want in place. Sure I have gained some insight, but if I could gleam knowledge from

an experienced member, I would be so greatful. I'm not one to just use and loose. Just some help, and I'll hack away

until I am knowledgable enough, or until I am stuck again.

Regards

Huckleberry

 
Huckleberry:

Hello to whom it may concern,

Learning this lanugage is a challenge. A challenge of which I accept, but I sure could use some experienced

person who could lend a hand to explain a few basic steps. Once I can get the idea, I would be willing to help others.

But at this time I am so lost . It has been for four days of reading and I have not moved an inch.

I know what rules I want in place. Sure I have gained some insight, but if I could gleam knowledge from

an experienced member, I would be so greatful. I'm not one to just use and loose. Just some help, and I'll hack away

until I am knowledgable enough, or until I am stuck again.

Regards

Huckleberry

Im not an instructor but i sent you a PM with a link to a very good tutorial created by Coders Guru...it will help cos it pus things simply.


cheers

 

Hi Huckleberry,

you might want to have a look at the ongoing thread in this forum entitled "adventures of a newbie".


Cloudbreaker and more recently myself have been trying to coach Nick over the learning hurdle of MT4 programming. I have discovered through this exercise is that it is much harder and more tiime consuming to teach a complete novice how to program in MT4 than I thought it would be, but together we do seem to be getting there, both using quite different approaches.


I had thought about putting a summary of this exercise into an article with step by step examples of code development.


Would something like that be of any help to you?

Regards

Tim

 

Hey Huckleberry,

Yep, as Tim said, it is a challenge indeed if you have no coding background. Tim and CB are very good and patient trainers. Key thing is don't give up however hard it may seem (despite the headaches and the pain it occasionally causes).

What helps me keep on track is to have a clear vision of your strategy, your aims and where you want to head (like the ideal result). I remind myself of that many times every single day to keep me focused and keep the physical activity going. I trade the strategy manually as well on a daily basis to keep my faith up (if this may or may not apply to you).

Do you have a clear strategy set in mind that you want to program?

Tim, as I am as green as they come, I would be happy to participate in the project you suggested (with Huckleberry if he is interested) and create with you experienced guys some sort of document 'Programming in MQL for a Complete Newbie' or something like that, as I think the mql book and Code Guru's notes are still outside of a typical newbie's comprehension level. The very basic essential stuff is coming out in the thread that you guys are answering to, and the book and other materials are a whole level up from that.

 
23510 wrote >>

Im not an instructor but i sent you a PM with a link to a very good tutorial created by Coders Guru...it will help cos it pus things simply.

cheers

Good Morning to you all, It isabout 08.22 hr here in California.

It was great to open my computer to find three replies this morning.

To the three, you understand that I am accepting the challenge to learn this.

Thanks for pointing me towards the Code Gurus. I'll check into them as soon as I

am finished here. I recall from reading "adventures aof a newbie" that he was turned onto the Code Gurus as well.

TSWilson, it would be of big help to me as well as to other novice program writers if you could piece together an article with the step by step process of developeing a system. An article such as that would most time consuming. Thank you for your efforts.

And Niko, I understand that your are a newbie, but with the coaching you have come far. I hope to be where you are soon. Yes, Niko, I do have a system and have been useing it manually for a few months. Not saying it is the newest and greatest, just that with the BT that I manually have down, (

I am pleased with the results. But if I could learn this lanugage, what a relief from all the manual work.

Sure I will participate. I have some very basic questions from the observations I have made. Regards Huckleberry
 

Hey Huckleberry,

Sunny California heh, you are a lucky man! I want to buy a yacht and travel around the world in it, will definintely stop by California on the way, and we can have some champaigne together!


Tim if you accept the challenge for a Newbie Article, I think the newbies must be involved from the beginning, as the questions and misunderstandings we have would form the core of the article. I already had a think about this and put some notes together.


Huckleberry, if you want to help everyone with such a document, why don't you put a list of questions together of what you don't understand or feel confused by in the coding process. I have done the same with myself (some answers are in the 'adventures of newbie' thread), then we can turn to gurus to help us with the answers and put together an article for other newbies. I think it's an amazing move from everyone on this forum trying to make mql more accessible to complete newbies. I think it's the right way forward, especially with the generation Y populating the planet as we speak who are reportedly highly creative and innovative. If we help everyone, everyone wins in the end - i believe.


nick

 
niko wrote >>

Hey Huckleberry,

Sunny California heh, you are a lucky man! I want to buy a yacht and travel around the world in it, will definintely stop by California on the way, and we can have some champaigne together!

Tim if you accept the challenge for a Newbie Article, I think the newbies must be involved from the beginning, as the questions and misunderstandings we have would form the core of the article. I already had a think about this and put some notes together.

Huckleberry, if you want to help everyone with such a document, why don't you put a list of questions together of what you don't understand or feel confused by in the coding process. I have done the same with myself (some answers are in the 'adventures of newbie' thread), then we can turn to gurus to help us with the answers and put together an article for other newbies. I think it's an amazing move from everyone on this forum trying to make mql more accessible to complete newbies. I think it's the right way forward, especially with the generation Y populating the planet as we speak who are reportedly highly creative and innovative. If we help everyone, everyone wins in the end - i believe.

nick

Sunny it is. Wish we had more rain. It is in drought condition. But come on by with the yacht and chilled champaigne. 'Tis nice to sail thru the San Fransico Bay.

A very big chore to build an article for the novice such as us. TSWilson, my hat is off to you.

What will be a big help to me, is learning where these abreviations (init, bool, etc.) go within a program, and just what do they represent, which one would come first (or if there is a hierarchy between them)?

Within the program (system) I do see that money management does come into play. I like that, but can the programmer write into the system, that a tarde can have additional positions put on. Such as, starting a trade with 2 lots, and as the trend continues, another 2 lots can be added on when certain conditions are met. Example would be that if the trend brings 20 pips of profit, another 2 lots are added on, etc. up to, for example, 4 pivots and then just let the trade eventually get stopped out by the trailing stop that has been in place from the beginning???

Also, I have read that many traders here get into a trade and get out rather quickly. Can MQL4 be written for a long term trader. A trade that is held for many days, or possiblly for many weeks??? My style of trading has had only 46 trades (not including the pivots involved in the winning trades) in the last 30 months? A boring but profitable system. This system is not considered romantic at any means. Boring. Hang onto the winners until the trend turns against me.

So much more going thru my head. But a simple system all the same. Good trading to you, Huckleberry

 
Huckleberry:

Sunny it is. Wish we had more rain. It is in drought condition. But come on by with the yacht and chilled champaigne. 'Tis nice to sail thru the San Fransico Bay.

A very big chore to build an article for the novice such as us. TSWilson, my hat is off to you.

What will be a big help to me, is learning where these abreviations (init, bool, etc.) go within a program, and just what do they represent, which one would come first (or if there is a hierarchy between them)?

Within the program (system) I do see that money management does come into play. I like that, but can the programmer write into the system, that a tarde can have additional positions put on. Such as, starting a trade with 2 lots, and as the trend continues, another 2 lots can be added on when certain conditions are met. Example would be that if the trend brings 20 pips of profit, another 2 lots are added on, etc. up to, for example, 4 pivots and then just let the trade eventually get stopped out by the trailing stop that has been in place from the beginning???

Also, I have read that many traders here get into a trade and get out rather quickly. Can MQL4 be written for a long term trader. A trade that is held for many days, or possiblly for many weeks??? My style of trading has had only 46 trades (not including the pivots involved in the winning trades) in the last 30 months? A boring but profitable system. This system is not considered romantic at any means. Boring. Hang onto the winners until the trend turns against me.

So much more going thru my head. But a simple system all the same. Good trading to you, Huckleberry

How's it going?

Answers to specific questions.

Q1 where these abreviations (init, bool, etc.) go within a program, and just what do they represent, which one would come first (or if there is a hierarchy between them)?

A1 These are types of variable of which there are a number ( - bool, int, double, datetime, string). You can declare them outside all functions (all functions share them), or declare them within a function (they are only available to that function). You WILL use variables in your code. You might not need to use all types. You declare them where makes most sense and use them where YOU need them. There is no hierarchy.


Q2 Within the program (system) blah...blah money management blah...blah additional positions put on blah...blah when certain conditions are met blah...blah let the trade eventually get stopped out by the trailing stop blah...blah get into a trade and get out rather quickly blah...blah trade that is held for many days, or possiblly for many weeks.

A2 Yes, all this is easily possible and right in the sweet-spot of the MQL4 framework.


First things first.

1. Look at the documentation and how to declare and handle variables.

2. Also in the docs, learn about syntax for functions, code-blocks, curly brackets.

3. Appraise yourself of the purpose of the special functions init() and start() - and to a lesser extent deinit().

4. Open up the sample .mq4 files in your platform (in the experts folder) and annotate for yourself what each line is doing (with reference to the docs)


As you can gather, the documentation section on this site is a key resource.


CB

 

Hey Huckleberry / CB,

I am putting together an article on basic functions (how to structure them, how to call them, declaring variables, etc). This is based on help by Tim and CB, and I think it will help other newbies.

Huckleberry, if you could start doing the same with your questions (ie just put them in a text file and underneath each question put the answers given on this forum, and keep this file updated on your computer but don't post it yet)_ then we can compile the two documents into 1 article once we gather a lot of info.

...

Hopefully the article the way i can see it, will take a total newbie (like me or you) and guide them to build a small strategy step by step, explaining each bit, each function, where brackets go, etc. This is how I started and what the gurus did with me. I just had 1 OrderSend function about a month ago, and then started adding things to it (but didn't know how to do it properly as there was no simple guide, and so i got completely lost, hence turned to this forum).

...

So I document that would guide a total newbie to programming, to buliding a basic strategy (eg: a golden cross for multiple pairs or anything like that). Once the basics are understood the newbie can then start to modify the indicators and add new functions, etc.

...

What do you guys think about this?

nick

 
TSWilson:
...

Would something like that be of any help to you?


It would be definitely a lot of help to me :)


I am also a beginner in creating MQL scripts. I'm not a beginner in investing and I'm certainly not a beginner in programming. I know theory and practice, I can get where I want to... sometimes there is a problem "where do I want to get" and "is it possible". I don't want to spend months and hundreds of Euros to find out that "naaah, this is not the right approach".

What would be most helpful would be case studies. How people struggled to get to the point of operating profitable live system. What were their biggest failures, problems and most importantly how did they have to change their thinking.

If there was a book "diary of a successful MQL trader" I would definitely buy it :]

 

I must be a masochist putting myself up for the task of writing an article on how to program for newbies. I’ve managed to get a lot of useful information from this community website and the truth is that it is now pay back time for me.


What you are saying you want to do Huckelberry would seem to be quite easily achieved within the metatrader system. In my opinion MetaTrader is very versatile and probably one of the best and easiest systems around for automated or semi automated forex trading. I think the plan with the new version; MT5 is to extend it to accommodate other trading instruments such as shares, cfds and futures etc. I expect MetaTrader will really make an impact when brokers start making these instruments available on it.


My approach to programming in MetaTrader or for that matter anything is based on many years of experience with commercial software design, programming and development.


Basically it is a 3 step approach.

  1. Specify accurately and in detail what you want to achieve
  2. Code the program to the specification
  3. Thoroughly test the application to ensure that it complies with the specification laid down in step 1.

It sound pretty basic doesn’t it but you would be amazed at the number of commercial organizations who want to skip part or all of step 1 and often part of step three and just “get on with the coding”. This is usually in the mistaken belief that they can save time, money or both by eliminating or reducing these tasks which they perceive as "non essential".


Nothing could be further from the truth. On various occasions we have walked away from large, potentially lucrative contracts where clients wanted to cut corners. Then some months down the track one hears about “project X” that another software developer has picked up, going off the rails. The deliverables aren’t delivering what was expected, the budget has blown out, lawyers are snarling at each other and key people are leaving the project like rats abandoning a sinking ship.


The worst sort of person to deal with at the corporate level is the new inexperienced manager, out to make an impression. They often do create an impression but not necessarily the sort that they originally had in mind.


The newbie programmer can easily be lured into the same trap as his corporate cousin. The desire to jump into coding before a proper specifications or structure are in place. often leads to the sort of questions that frequently appear on this forum. “Help – Why doesn’t my program do what I want it to do”? I expect that most of these people would not appreciate being told that their problem probably has its origins in poor design or lack of a proper program structure.


Of course soon or latter you do have to get your hands dirty and write some code. MT4 is a fairly straightforward, simple language to learn and use. MT5 may be a little more complex. We will have to wait and see. Its simplicity however can be a trap for the newbie because it allows a programmer enough freedom to easily create a horrible mess. Since the programming language doesn’t impose a lot of structure, a programmer must do it for them self or face the consequences - i.e. code that is buggy and difficult to maintain or modify.


The elements of the metatrader language are typical of those found in the majority of programming languages in use today. Data types, operators, variables, expressions functions etc all need to be understood. If the newbie has had some experience with another programming language it will probably be very easy to learn MT4. If not then the learning curve, for some, will be quite steep.


One common way to gain this coding knowledge is to work your way through a set of structured exercises. There are plenty of books around with such exercises for most of the common programming languages but to the best of my knowledge, nothing exists like this for MT4. Perhaps we need to create some?


Finally we come to the third step of our program development cycle – testing.


Testing is very important in a program that you are going to trade your hard earned with. Subtle bugs can play havoc with your trading strategy and your account balance.

The MetaTrader testing environment is quite workable but may prove to be bit challenging for programmers migrating from other modern languages like those available for the windows environment. Unlike these modern languages, MetaTrader does not have a debugger. Testing and debugging is typically carried out by writing messages to a log file.


There are a couple of other methods that can be used to look into the workings of the code but, like log files, the programmer must specifically create code to do this.


The programmer also needs to plan and provide for error handling. If something does go wrong you want to know what where and how it happened, long before the problem affects your bottom line.


Just running the program on the strategy tester a couple of times and seeing if it makes a profit does not constitute proper testing. All code functions and modules need to be systematically tested to make sure they perform as designed. This process can be quite tedious and time consuming.


So is it possible for a newbie, without prior experience to become a proficient programmer in a reasonable amount of time? Of course it is, although the time required could vary significantly between individuals depending on aptitude and learning ability.


But if you do decide to become a coder – trader, please make the time and effort to learn to do it well. You will ultimately save yourself and others endless frustration and possibly save yourself a lot of dollars as well!

Reason: