Download MetaTrader 5
To add comments, please log in or register
Do you have Mac OS? Find out how to install MetaTrader on it!
winterz
104
winterz 2015.04.02 14: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! 

Miguel
29
Miguel 2015.04.02 17: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. 

Keith Watford
Moderator
7908
Keith Watford 2015.04.02 21: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. 

winterz
104
winterz 2015.04.07 16:16  
Thanks for both of your replies! Very helpful. I will have a play now and get back to you on my findings :)
/
To add comments, please log in or register