Replicating MT4 function in my EA

 

I am writing an EA where I draw a horizontal line at a specific price level. This is similar to placing a S/L or T/P in MT4 where a line is drawn at the specific level or dragged from the transaction line to the specific price level. In MT4 you can also drag the existing line to a new position and the value of the S/L or T/P is automatically updated.

How can we do this dragging of the line with automated update of the new position in MQL4? I have searched and searched and cannot find any code examples of this function.

Can anybody perhaps help?

 
ernest02:

I am writing an EA where I draw a horizontal line at a specific price level. This is similar to placing a S/L or T/P in MT4 where a line is drawn at the specific level or dragged from the transaction line to the specific price level. In MT4 you can also drag the existing line to a new position and the value of the S/L or T/P is automatically updated.

How can we do this dragging of the line with automated update of the new position in MQL4? I have searched and searched and cannot find any code examples of this function.

Can anybody perhaps help?

You have to use OnChartEvent handler with CHARTEVENT_OBJECT_DRAG event.
Reason: