Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1772

 
Nerd Trader #:
But the second bot needs a timeframe, you didn't read it carefully.

This you have written incorrectly. The second Expert Advisor needs the timeframe at which the signal to enter (or open an order) was received. Then, use a global variable to save the timeframe (in the first robot). And read it with the second robot.

Документация по MQL5: Глобальные переменные терминала
Документация по MQL5: Глобальные переменные терминала
  • www.mql5.com
Глобальные переменные терминала - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Apart from creating an array to store orders' TFs by first reading them from the order's comment, is there any other easy way to transfer the TFs to another bot? And this bot is running on a remote server. We could use a socket but it is still difficult for me.
 
Mihail Matkovskij #:

This you have written incorrectly. The second Expert Advisor needs the timeframe at which the signal to enter (or open an order) was received. Then, use a global variable to save the timeframe (in the first robot). And read it with the second robot.

It doesn't work that way, because the bot is running on a remote server, so I write the TF in the comment, that would be fine, but it is overwritten by the ticket when you close part of the volume.

 
Nerd Trader #:
So it's a bot, not the point.

How is that not the point?! Any programmer will tell you that the indicator does not make trades. Study the documentation carefully before you start developing applications.

Nerd Trader #:

You can't do that because the bot is running on a remote server, so I write the TF in the comment, it would be OK, but it is overwritten by the ticket when you close part of the volume.

Then, let the 1st robot in parallel opens a market or pending order with minimum volume and it will be possible to write a comment there, which will not change.

 
Nerd Trader on a remote server.

This option is even easier than I suggested.

Create an array of pointers to objects: ticket - order info. When the order is closed, delete the object and delete the pointer from the array. There is nothing difficult. But you will have to learn how to work with dynamic arrays, pointers and classes. I must have said something frightening for you. :)
 
Mihail Matkovskij #:

How is that not the point?! Any programmer will tell you that the indicator does not make trades. Study the documentation carefully before you start developing applications.

Then let the 1st robot simultaneously open a market or a pending order with a minimum volume and you can write there a comment that will not change.

I don't care what he's not producing :) I might as well say I made a typo.


<<Then let the 1st robot in parallel open a market or a pending order with minimal volume, and it will be possible to write there a comment, that will not change. >>

oh no thanks :) save Bill Gates from such maneuvers.

 
Nerd Trader #:

it doesn't work that way, because the bot is running on a remote server, so I write the TF in the comment, that would be fine, but it is overwritten by the ticket when you close part of the volume.

To write the information about TF into the order we need to use its magic number. But this attribute never changes. We should conditionally number all TFs in order and generate a magic number considering this number + leave some space for the ID function, bitwise operations are better.

 
Nerd Trader #:
I may say I made a typo.


No. It's not a typo. You just don't understand the difference between a robot and an indicator. And it's obvious to any programmer. Read the documentation:https://www.mql5.com/ru/docs/runtime/running.

Quote from the article:

Each script, service and expert works in its own separate thread. All indicators calculated on one symbol, even if they are run on different charts, work in one thread. Thus, all indicators on one symbol share the resources of one thread.
The following functions are prohibited in indicators :


Документация по MQL5: Программы MQL5 / Выполнение программ
Документация по MQL5: Программы MQL5 / Выполнение программ
  • www.mql5.com
Выполнение программ - Программы MQL5 - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Mihail Matkovskij #:

This option is even easier than I suggested.

Create an array of pointers to objects: tikets - order information. When the order is closed, delete the object, and delete the pointer from the array. There is nothing difficult. But you will have to learn how to work with dynamic arrays, pointers and classes. I must have said something frightening for you. :)

Very much so. I imagined creating a structure with two din. arrays tikets and timeframes, where the values are placed according to their names.

 
Mihail Matkovskij #:

No. It's not a typo. You just don't understand the difference between a robot and an indicator. And it's obvious to any programmer. Read the documentation:https://www.mql5.com/ru/docs/runtime/running.

Quote from the article:

geez, all right, all right, you just don't get nervous.