EA position on chart

 

Hi,

I would appreciate some help on the two issues described below.

If a user drags and drops an EA to the chart, is there any way for this EA to find out the exact time/price where the user has dropped/released the EA on the chart?

Another question: can an EA make some kind of call to the user interface of metatrader to open the new order menu or modify order menu?

Thank you!

 
Theoretically it's possible, but I guess you want somebody gives you already written solution?
 

Hi Roger,

no, I can write the solution myself if I know how. I havent found any functions in the api that make it possible; It seems impossible for an EA to find out where exactly it was released on the chart. Am I missing something?

Same goes for the opening of the order window; I didn't find any functions in the API to do this. Suggestions are welcome.

Thanks for the help.

 
You can use Windows libraries like user32.dll, winapi.dll.
 

Hi Roger,

I appreciate the help. I did a quick google search and I can see that the second problem could probably "somehow" be solved throug the use of ancestors/windowhandlers etc..

However, I still have no idea how to find out where the EA was dropped through the windows api. Maybe you or someone else could point me in the right direction for this one?

Thanks for the help!

 

Look at this example how to change accounts in Favorite Tab of Navigator window

Files:
count_en.mq4  4 kb
 

Thanks for the help guys,

However, I still didn't manage to open the modify window for an already existing order though. I guess that I am really asking for a written solution now..
Excuse my ignorance.

Thanks

 

What is your last goal? May be you don't need so complex solution.

Look at my old script where I realize vertical coordinates. Probably you can find something for your task.

Files:
 

Hi Roger,

Thanks for the attached file, but the trailing line functionality etc is not really the problem.

I have a client that basically wants to speed up the orderplacement/modification process. The EA places an order at the price level where it was released on the chart; the stoploss line, takeprofit line and openingline is automatically created for this order. The user can modify the takeprofit and stoploss by draging and releasing the lines.. all of this is not a problem and is supported through mql functions etc.

But.. the client also wants to be able to double click the original opening line to make the order modify window pop up; This way, the user can immediately input the new stoploss and take profit and confirm. This EA is basically a hack to speed up the normal orderplacement/Modify process. (To modify this order the user does not need to go to the terminal trade window and right click the order before the modify window pops up).

The problem: I'm having trouble opening up the order modify window of the requested order. It seems that I have to play around with the window handlers to somehow navigate to the trade window and perform the right click --> modify order using the windows api. It seems that the developers of mql4 don't intend for the programmers to this is because it is certainly not that easy.

Thank you.

Reason: