Object drag and drop control through mt4/mql4

 

Hi,

In mt5/mql5 there is the possibility to drag and drop lines and objects on the charts in metatrader. An EA can capture these events and perform logic accordingly. For example: Lines indicating TP and SL levels could be drawn on the chart by an EA. The user could manually drag and drop these lines to move the SL and TP levels; the EA can capture these events and respond accordingly to modify the orders.

My question: can something similar be done in mt4/mql4? I know that there is no standard special event to capture object movements in mql4; However, I also know that it's possible to go through the object list to find out where objects are currently placed, so this is not really a problem. BUT, the problem is that the user seems to be unable to move the objects on the charts without going through menus etc? The user cannot drag and drop objects in metatrader4 or am I missing something? (I don't have a lot of experience with mt4). What would be the best solution to implement the moving SL/TP behavior that I just described?

Thank you!

 

You could create a script that puts a couple of lines on the chart that the user can move about to represent TP and SL, the benefit of this is that you control the Object names. Or even better do it from your EA, if the lines aren't there create them . . .

To move an object double click it to select it, then it can be moved around . . .

 

should use winuser32.mqh

https://www.mql5.com/en/code/8646

 

No need to used library's if only drag and drop movement is needed. Already done:

https://www.mql5.com/en/code/10009 (There is a small typo in the code but it work as it should)

 

Hi,

Thanks for the suggestions guys, I appreciate it.

Reason: