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

 
psyman:

If there is more than one position open by hand, how do I assign the EA to the one that needs to be trawled?

So far, I have only thought of starting a script that creates a GP and copying the ticket from there.

Is it possible to feed the ticket value to the owl input as input int or at least as enum of enumerations of ticks of all positions of the given symbol?

Clicking on the open position icon/set order selects it as a trawl target. Clicking+Ctrl selects multiple positions/orders for the trawl. All you need to do is write the reaction to click events on the objects. And allow to set position/order icons.

 
Artyom Trishkin:

:)

What if you run the EA at 9.22 ?

What if there is a system or terminal failure? The price will be lost.

I.e., you have to look for what was 20 minutes ago when the time of this check comes. The time has come in which the minutes are greater than or equal to a multiple of twenty - check the state of RSI on the bar, which was 20 minutes ago. If it has the desired crossing, then we proceed as planned...

However, on M15 you cannot determine the exact time of crossing and the exact price, but you can look at the price on M1 - at least 15 times more accurate.

Can't you make a notepad that will record the exact time of crossing and the price?)
There are EAs that record all kinds of information in a notepad.

 
Alexey Viktorov:

More often GV from GlobalVariable*** is used, I wouldn't ask this question then. The question is ambiguous. There are many positions, but we need only one trawl. Is it the same Expert Advisor that sets positions? The question sounds strange in this case. If the positions are placed manually or by another EA, then, when you run the EA, insert in input ticket and that's it... If the Expert Advisor sets a random number of positions and the list can be changed on the fly... Freelancing is useful.


You understand correctly and even write what needs to be done, but don't say how :-)

Positions are opened by hand, the owl can only distinguish them by the ticket. I can paste the ticket by hand via copying to the buffer, but it's better not to do that, but offer to choose from a list. Is it possible to do so?

 
Artyom Trishkin:

Question: are you talking about the IntelliJ IDEA development environment ?

Yes, I am talking aboutIntelliJ IDEA

 
secret:

All life seems to be here, no one looks at the individual threads.

Look at my question, please: Can I invent an analogue of CopyBuffer() for MT4?

https://www.mql5.com/ru/forum/302404

Yes, but in this case you need to complete the code of indicator, which should produce its own buffer

 
psyman:

You understand correctly and even write what needs to be done, but don't say how :-)

Positions are opened by hand, the owl can only distinguish them by the ticket. I can paste the ticket by hand via copying to the buffer, but it's better not to do that, but offer to choose from a list. Is it possible to do so?

Everything is possible. For example to display a panel with positions, and in it to choose for what track. But it's more like you said above in Freelance.

 
Artyom Trishkin:

Clicking on an open position/order icon selects it as a trawl target. Click+Ctrl to select multiple positions/orders for trawl. All you need to do is to enter reaction to click events on the objects. And allow to set position/order icons.


So it corresponds to execution of PositionSelect?

 
psyman:


So this corresponds to the execution of PositionSelect?

No, it doesn't. It was a suggestion as to how it could be done.

 
Artyom Trishkin:

Clicking on the icon of an open position/set order selects it as a trawl target. Clicking+Ctrl selects multiple positions/orders for the trawl. All you need to do is to insert reaction to click events. And allow to set position/order icons.

You must be referring to the trawl built into the terminal? It can't do partial closing, which is what I want to do, that's why it's such a mess.


=Ijust need toput in reaction to events of clicking on objects.

And how can I handle events outside of the graphic window?

From what is written in help, none of the event types is suitable.

 
psyman:

You must be referring to the trawl built into the terminal? It can't do partial closing, which is what I want to do, that's why it's such a mess.


=Ijust need toput in reaction to events of clicking on objects.

And how can I handle events outside of the graphic window?

From what is written in help, none of the event types fits.

I understand that the Expert Advisor needs to somehow indicate the ticket of the position opened manually that it should trawl.

  1. Add to the Expert Advisor tracking of newly opened positions and if it does not have a magik, it means that it is opened manually. The Expert Advisor shall put an opening icon of this position on the price and bar of its opening. The name of the object must contain a prefix with the common name of the object for all such objects, for example "manual_" and the position's ticket must also be present. As a result, name of the object can be as follows: "manual_12345678". Here: manual_ - prefix, 12345678 - position ticket.
  2. Add to the Expert Advisor OnChartEvent() and monitor the event of the mouse click on the object. Analyze the name of the object and if it contains a substring manual_, then look for a number after manual_. This number is the ticket of the position whose icon you clicked.
  3. The next step is a technical matter: you need to store the found number, so that it is not lost when you restart the Expert Advisor/Terminal/Computer/World... For example, in resources or global variables of the terminal.
  4. The Expert Advisor should read this resource and take the ticket of the position to be trawled from it
  5. In the trawl cycle, you should fetch the ticket of the selected position and look for this number in the list of saved tickets. If such a ticket is found, the position with this ticket must be trawled.
  6. If the number of positions is changed, the ticket of the closed position must be checked and found in the saved list. If such a ticket exists in the list, it must be deleted from the list - the position no longer exists, and there is nothing to do with its ticket in the list of tickets for baiting.
It goes something like this. The logic was written on my knees, so I may not have taken anything into account...
Reason: