Last time we have talked about the Comment function. It enables any kind of trader to get more relevant information on the chart without much effort, because it can print out several types of information.
MQL4 Account Information documentation here
We have started with the Account Balance. If you have done that, you might have noticed that the term AccountBalance() was followed by two round brackets.
Any time you see this, you know you have found something that is like a little programm you can use in your code to calculate something or to give back some kind of value.
This is called a function. If you ask somebody on the street “Could you tell me the time, please?” you have called the function “TellMeTheTime()”.
That is the most easy way to call a function, because you will not need to deliver more information. He will know, what kind of time you are asking about.
Otherwise, if you would ask the same person “Could you tell me the way, please?”, he might be a little irritated, because there is some information missing. Where do you want to go? That piece of missing information is called a parameter. Depending of the parameter you give that person he will give you a different answer. In MQL4 this would be something like:
TellMeTheWay(Airport) or TellMeTheWay(railway station)
Last time we used two functions. One was the Comment() function and the parameter AccountBalance() was inside the round brackets.
That is like asking: “Could you comment my (AccountBalance()) please?”.
There is lots of Account Information available, here are some examples you can use:
AccountFreeMargin() for example will tell you, what? The free account margin of course. What do you think does AccountProfit()? You see how easy that is? If you want to know more about your account, for example the AccountStopoutLevel(), you will find the direct link to all the types of account information in the show notes for this episode.
Oh, you are not restricted to print out only one information on the chart. You can line them up inside the round brackets of the Comment function. The only thing you need to do, is to seperate them by commas.
Comment (AccountBalance(), AccountEquity(),AccountFreeMargin());
would be totally fine for the compiler, but it is hard to read for humans if there isn’t any explanation what all that numbers actually mean.
In the next episode we are going to make the output a little nicer for us humans by adding additional text with a userfriendly description.