MQL5 TUTORIAL - How to show account info on your chart ( in 3 min)

Опубликовано: 01 Октябрь 2024
на канале: MQL5 Tutorial
206
9

https://mql5tutorial.com/?s=accountin...

In this video, we are going to create an Expert Advisor that retrieves and displays various account information on the chart. Let's see how we can do that.

We start Metaeditor by clicking the little icon or pressing F4.

The OnTick function is called every time a new tick is received for the symbol the Expert Advisor is attached to. Inside this function, we retrieve several pieces of account information using the AccountInfoString and AccountInfoInteger functions.

The AccountInfoString function is used to get string-type account information such as the server name, account currency, and account name. The AccountInfoInteger function retrieves integer-type information like the trade mode, account login, leverage, and limit orders. The AccountInfoDouble function is used to get double-type information such as the free margin.

We also create readable versions for the trade mode and margin mode. The trade mode can be a demo account, contest account, or real account, and the margin mode can be netting mode, exchange mode, or hedging mode.

After gathering all the account information, we use the Comment function to display this information on the chart. The Comment function outputs the account server, currency, name, trade mode, login, company, leverage, limit orders, free margin, and whether trading and expert trading are allowed, along with the margin mode.

Once we have written the code, we press F7 to compile it.

If this was too fast for you or if you don't understand what all the code is doing, you may want to check out the Premium course on our website or watch one of the basic videos first.

If the compilation is successful, we go back to MetaTrader by pressing F4 or clicking on the icon.

Back in MetaTrader, we press Control and R to start the strategy tester, pick the Expert Advisor that we have just created, enable the visual mode, and start a strategy test.

We should now see the Expert Advisor displaying the account information on the chart.

If you are already a Premium course member and have an idea for a video like this one, you can send us an email.

In this video, we have learned how to create an Expert Advisor that retrieves and displays account information using a few lines of MQL code.

Thanks for watching, and I will see you in the next video.


Смотрите видео MQL5 TUTORIAL - How to show account info on your chart ( in 3 min) онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь MQL5 Tutorial 01 Октябрь 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 206 раз и оно понравилось 9 людям.