Drag Horizontal Line and Store Price (Script)?

Back to topics list To post a new topic, please log in or register
avatar
36
winterz 2015.04.02 16:21
 

When I drop script onto chart, I want a horizontal line to be created and the flexibility to move this line where I want with the view of returning the price once I lock it in and the script continuing with the rest of the code.

 I know how to code so i am not asking for someone to do this for me, just merely asking if someone could be kind enough to point me in the right direction that's all :) (or even examples of where people have done something similar).

 Many thanks in advance! 

avatar
16
xiruko 2015.04.02 19:52 #
 
winterz:

When I drop script onto chart, I want a horizontal line to be created and the flexibility to move this line where I want with the view of returning the price once I lock it in and the script continuing with the rest of the code.

 I know how to code so i am not asking for someone to do this for me, just merely asking if someone could be kind enough to point me in the right direction that's all :) (or even examples of where people have done something similar).

 Many thanks in advance! 

You could use a message box (https://docs.mql4.com/common/messagebox) after placing the horizontal line in order to pause the script and then you would have time to move the line where you want. Once you have it on the right place, simply click "OK" and the script will continue.

 Regards. 

avatar
Moderator
3404
GumRai 2015.04.02 23:55 #
 

When the script creates the line set OBJPROP_SELECTED to true

Use a while loop to check if OBJPROP_SELECTED is false, if it is, break from the loop and continue

That way you will be able to move the line and the code following the create will only be executed when you double click on the object to de-select it. 

avatar
36
winterz 2015.04.07 18:16 #
 
Thanks for both of your replies! Very helpful. I will have a play now and get back to you on my findings :)
Back to topics list  

To add comments, please log in or register