Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
dTub
Скачать

MQL4 TUTORIAL BASICS - 36 SIMPLE MOUSE CLICK EVENT

Автор: MQL4Tutorial

Загружено: 2019-09-21

Просмотров: 4010

Описание:

https://mql4tutorial.com/?s=event

With MQL4 for Metatrader4 we create an Expert Advisor to handle mouse click events. Whenever we click on a chart, there is a chart event that we will use to output the X and Y coordinates.

In this video we are going to find out how to use a mouse click to bring up a message box, when I click on the chart nothing happens, let's drag the expert advisor on to a live chart, click on ok, and when I now click into the chart I will get a message box telling me the chart was clicked, we also see the coordinates here, so let's find out how to code that in mql4.

To do that please click on a little button here or press F4 on your keyboard, now you should see the Metaeditor window and here you want to click on file, new, expert advisor from template, continue, I will call this file simple mouse click, click on continue, continue and finish.

Now you can delete everything above the on tick function and let's also remove the two comment lines here. Well usually we like to use the on tick event, that's also an event but this one is automatically caused whenever the price changes, but this time we are going to use the on chart event because when I click on the chart the event is fired.

This one takes a few parameters.

The first one is for the event id, you see that we use the term const because it's a constant value – in this case, an integer value – and we are going to find out the kind of event id that is fired and check if it is a mouse click.

The second parameter is a long parameter so it's called lparam for long and this is not a mistake, it's the way that you can pass values by reference in mql4, the third parameter is called dparam because it's a double value, and the last one is called sparam because it's a string value, and that's basically it.

So what can we do?

We want to check if the id equals chart event click – all in capital letters – and if that is the case we will use a message box that will contain the text: “the chart was clicked”, it will output the x value that is what is inside of the l parameter, we also want to know the y value that's inside of the d parameter, this message here is just their heading and our message box will only have one button, that's the okay button and that's about it.

When you are done you can click on the compile button here or press F7 on your keyboard… Oh, I did something wrong because this one needs to be the event id, so let's recompile the code and this time it worked.

If this is also the case for you, you can click on a little button here or press F4 to go back to Metatrader.

And in Metatrader right now when I click on a live chart nothing is happening so let's drag the expert advisor right on to the live chart, click on ok, now you should see the little symbol here and when you click on to the chart the message box comes up right away.

By the way that wouldn't work in the strategy tester, if you would like to do something like this and use the strategy tester you would need to use the comment statement because the message box is not supported but it works on our live chart and in this little video you have learned how to get the coordinates for a mouse click on the chart and show a message box with the values and you have coded it yourself with a few lines of mql4 code.

MQL4 TUTORIAL BASICS - 36 SIMPLE MOUSE CLICK EVENT

Поделиться в:

Доступные форматы для скачивания:

Скачать видео mp4

  • Информация по загрузке:

Скачать аудио mp3

Похожие видео

MQL4 TUTORIAL BASICS - 73 SIMPLE SPREAD FILTER

MQL4 TUTORIAL BASICS - 73 SIMPLE SPREAD FILTER

MQL4 TUTORIAL BASICS - 40 SIMPLE BUY BREAKEVEN STOP

MQL4 TUTORIAL BASICS - 40 SIMPLE BUY BREAKEVEN STOP

Почему на конденсаторе такая метка? Вот почему!

Почему на конденсаторе такая метка? Вот почему!

Но что такое нейронная сеть? | Глава 1. Глубокое обучение

Но что такое нейронная сеть? | Глава 1. Глубокое обучение

Как сжимаются изображения? [46 МБ ↘↘ 4,07 МБ] JPEG в деталях

Как сжимаются изображения? [46 МБ ↘↘ 4,07 МБ] JPEG в деталях

18) Как побеждает Карлсен? Вашье-Лаграв — Карлсен Vachier-Lagrave - Magnus Carlsen

18) Как побеждает Карлсен? Вашье-Лаграв — Карлсен Vachier-Lagrave - Magnus Carlsen

Почему простые числа образуют эти спирали? | Теорема Дирихле и пи-аппроксимации

Почему простые числа образуют эти спирали? | Теорема Дирихле и пи-аппроксимации

Python Tutorial for Absolute Beginners #1 - What Are Variables?

Python Tutorial for Absolute Beginners #1 - What Are Variables?

Учебник по Excel за 15 минут

Учебник по Excel за 15 минут

ОСНОВЫ MQL4 - 37 КАК ИМПОРТИРОВАТЬ ВНЕШНИЙ ИСХОДНЫЙ КОД

ОСНОВЫ MQL4 - 37 КАК ИМПОРТИРОВАТЬ ВНЕШНИЙ ИСХОДНЫЙ КОД

ОСНОВЫ MQL4 86 ПРОСТОЙ ОБЪЕКТ КНОПКИ «КУПИТЬ»

ОСНОВЫ MQL4 86 ПРОСТОЙ ОБЪЕКТ КНОПКИ «КУПИТЬ»

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

Где начало СХЕМЫ? Понимаем, читаем, изучаем схемы. Понятное объяснение!

Понимание Active Directory и групповой политики

Понимание Active Directory и групповой политики

Я позволяю ChatGPT создавать торговых ботов для MT5 (шаг за шагом)

Я позволяю ChatGPT создавать торговых ботов для MT5 (шаг за шагом)

Маска подсети — пояснения

Маска подсети — пояснения

Что такое IP-адрес? // Ты полный ноль в подсетях // Эпизод 1

Что такое IP-адрес? // Ты полный ноль в подсетях // Эпизод 1

LLM и GPT - как работают большие языковые модели? Визуальное введение в трансформеры

LLM и GPT - как работают большие языковые модели? Визуальное введение в трансформеры

Изучите Microsoft Active Directory (ADDS) за 30 минут

Изучите Microsoft Active Directory (ADDS) за 30 минут

💾СОБРАЛ NAS НА TrueNAS💽 НЕ ПОНИМАЮ, КАК ЖИЛ БЕЗ НЕГО САМОДЕЛЬНОЕ ХРАНИЛИЩЕ ЭТО ПРОСТО

💾СОБРАЛ NAS НА TrueNAS💽 НЕ ПОНИМАЮ, КАК ЖИЛ БЕЗ НЕГО САМОДЕЛЬНОЕ ХРАНИЛИЩЕ ЭТО ПРОСТО

Сетевые протоколы — ARP, FTP, SMTP, HTTP, SSL, TLS, HTTPS, DNS, DHCP — Основы сетей — L6

Сетевые протоколы — ARP, FTP, SMTP, HTTP, SSL, TLS, HTTPS, DNS, DHCP — Основы сетей — L6

© 2025 dtub. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: infodtube@gmail.com