DislikedMany thanks Steve, very useful, I have done quite a bit of programming in "C" and C++, MQ4 is not that different. My aim is always to keep functions tight to avoid spaggeti code. Unfortunately there are limitations in MQ4 that do not support a lot of the Object Oriented features of C++. Otherwise it is not a difficult conversion.Ignored
Another thing I am not very good at is commenting my code. One of the things I notice about pro-coders is that their comments always describe a function both in outline and down to individual chunks. I am trying to emulate this but it is hard.
For those of you starting out, my advice is to comment everything. A chunk of code whose purpose seems so screamingly obvious that it cannot possibly justify the time commenting, will take you an hour to decipher in two months time. Guess how I know.
More advice I offer to beginner coders is:
- learn the basics then start a project. Start with something simple, such as the trigger being the cross of a slower ma by a quicker one. Perhaps make this the setup, and the trigger is x candles heading in the right direction. Involve some management features and perhaps some sutomatic lot-sizing for money management. My code is open source so anyone can pinch it freely, but better for you if you work out your own salvation because you will understand better what is going on.
- Develop your own methods of presenting on-screen information thattell you what is going on inside the code as well as providing valuable feedback.
- As you master each individual step, try to make it into a universal function that you can add to your own shell ea, from which you can code a new bot in minutes - no point in re-inventing the wheel every time you have an idea and want an ea to try it out, This is how my shell ea evolved and I am still adding to it.
- Once you have the basics, delve into drawing trend lines etc on the charts via your code. To get started, type ObjectCreate into the mql4 editor, highlight it and press F1 for help; this will present the list of commands used to create and manipulate shapes on your charts, confusingly known as 'objects'.
- Remember Google. When stuck, google the problem. If it is solvable, then someone out their has both solved it and posted the solution.
Maybe I should copy this into post 1 of my shell ea thread.