Drag and drop SL and TP in the tester. - page 11

 
khorosh:
Made the SL and TP move with buttons as conceived in the previous post. It works fine. I think it's better and more convenient than moving SL and TP by dragging additional objects like lines, arrows, etc. The step of movement can be changed the same way with buttons.
In this case, the cyclic order search should be implemented analogously. The active one is the one you want to change. It is possible to mark the selected one with some icon.
 
Anatoli Kazharski:
The current state of the left mouse button can now be monitored by theCHARTEVENT_MOUSE_MOVE event (parameter sparam).
Yes, I use the CHARTEVENT_MOUSE_MOVE andCHARTEVENT_OBJECT_CLICK events to move SL and TP and poll the left mouse button status.
 
Artyom Trishkin:
Well, then do the same for cyclical order retrieval. The one that is active is selected to be changed. You can mark the selected one with some icon.
If there are several orders in the market, then it would be better to try to do dragging, as it is done on a real chart. I just do not know yet how to associate cursor coordinates in pixels with points. I'll have to read the documentation. If you know where to read it, please tell me so I don't have to search for it.
 
khorosh:
If there is more than one order in the market, then it is better to try dragging and dropping as it is done on a real chart. I just don't know yet how to associate cursor coordinates in pixels with points. I'll have to read the documentation. If you know where to read it, tell me, so I don't have to search for it.

https://docs.mql4.com/ru/chart_operations/chartxytotimeprice

,

ChartXYToTimePrice - Документация на MQL4
  • docs.mql4.com
ChartXYToTimePrice - Документация на MQL4
 
 
khorosh:

Thank you, that's it.

Poked the mouse at SL, moved and released the mouse - moved SL
 
khorosh:
If there are several orders in the market, then it would be better to try and do a drag and drop, like on a real chart. I just do not know yet how to associate cursor coordinates in pixels with points. I'll have to read the documentation. If you know where to read it, please give me a hint so I don't have to search for it.

Well, it's already been suggested...

In general, of course, you should not only look at mouse buttons, but also the Ctrl key. Then only when the Ctrl key is held will you be able to drag stops, otherwise there should be no reaction (just in case you might accidentally hit a line - you can't drag it behind the cursor).

 
Made a variant of dragging the stoploss on the visual test chart exactly the same as on the real chart. No difference and without any additional buttons or graphical objects. I can consult you on questions that are not clear to you. The branch may be closed.
 
Artyom Trishkin:
Well, then do the same for cyclical order retrieval. The one that is active is selected to be changed. You can mark the selected one with some icon.
I start a search of orders and determine which stop differs from the price accepted from the cursor by less than 2 points, then I save the ticket of this order in a global variable and exit the loop. Then I select the order by the ticket and set the stop loss price read from the cursor to that order when modifying it. After releasing the mouse button, the ticket of the selected order is reset.
 
khorosh:

Bragging? )

Either show the code or close the thread.

Reason: