One-click trading panel in mq4

 

How to write the code in mql4 that able to click BUY or SELL, change the lot size from 'one-click trading panel' automatically (auto-click) instead of OrderSend function. The reason ... some brokers don't accept OrderSend from the EA - they want my client to do manual trading only.

 

 

Hey Anton,

really? I´d change the broker, cause it´s the best proof that they don´t want you to earn money :)

But if you want to to it anyway, you should take a look at the message queue in Windows. This should not be so hard to realize. Windows manages all what happens in a queue, and what you have to do is to figure out, where the panel is and tell Windows - via the queue - that "someone" clicked on the panel.

You´ll find some detailed information here: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632590(v=vs.85).aspx

How to?

1. Include the WinUser32.mqh and add the functions you need. The user32.dll is much bigger and can to much more than that, what´s already declared. Actually the user32.dll is the master-key to Windows itself. It´s worth to take a deeper look at it.  

2. Figure out the dimensions of the chart and it´s physical position, because the panel is on a fixed place. You can do this by using the WindowHandle() function and GetWindowRect(), then you already know where the chart is physically on the screen.

3. Use PostMessage() to send a broadcast message to the queue. I don´t have the message codes ready, but you will figure them out quickly.

 

If you need more help, let me know.

Doerk 

 
Hi Doerk,

Yes, you are right by using the WindowHandle() function and GetWindowRect(), then mouse_event. That's awesome!!!

Thank you!!

Anton
 

You´re welcome :) 

But be careful with mouse_event, because this is an old function which is already declared as "obsolete" by Microsoft.  

 
Hello Mybe someone give me some sample code to do this with with in mql4, because my computer get some error when i learn to make a code....

thank's
Reason: