Jump to content

cannot click button on a window (Metatrader 4)


Recommended Posts

Hello.I am programming some automation via Expert Advisor(program in MQL ) in Metatrader 4 trade software.There is Virtual ListView Control in Metatrader 4 software . I want to read text of Virtual listview control using AutoItX3.dll .I get some functions (GetItemCount and others that is not related to text extract from control) working with this control but i dont understood how to read text from this control.  If it not possible to read text using AutoItX3.dll how to use AutoIt itself in MQL  to read text from virtual listview control ?   Thanks for answers. 

Link to comment
Share on other sites

Hello.I am programming some automation via Expert Advisor(program in MQL ) in Metatrader 4 trade software.I cannot initiate button click on a one of  window of Metatrader 4 software. I have attached screenshot of "Order" window of Metatrader 4 software. I need to click Buy by Market button on it. Here is Autoit Window Info summary on Buy by Market button  with Use Spy++ control detection logic enabled :

>>>> Window <<<<
Title:  Order
Class:  #32770
Position:   9, 149
Size:   769, 387
Style:  0x94CA00C4
ExStyle:    0x00010101
Handle: 0x001027FE

>>>> Control <<<<
Class:  Button
Instance:   9
ClassnameNN:    Button9
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:9]
ID: 65535
Text:   Market Execution 
Position:   315, 146
Size:   428, 195
ControlClick Coords:    312, 92
Style:  0x50000007
ExStyle:    0x00000004
Handle: 0x002E27A2

>>>> Mouse <<<<
Position:   644, 417
Cursor ID:  0
Color:  0xA0C0FF

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Symbol:
BTCUSD, BitCoin vs US Dollar
Volume:
1.00
1.00
Stop Loss:
0.00
Spin1
Take Profit:
0.00
Spin1
Comment:
Type:
Market Execution
Sell by Market
Buy by Market
Attention! The trade will be executed at market conditions, difference with requested price may be significant!
Market Execution 
22467.34 / 22562.91


>>>> Hidden Text <<<<
Sell
Buy
Enable maximum deviation from quoted price
Maximum deviation:
0
pips
Instant Execution 
22481.84 / 22577.80
Request Execution 
Request
Sell
Buy
Please request
Pending Order
Type:
Buy Limit
BTCUSD 1.00
at price:
0.00
Spin1
Expiry:
2023.03.06 22:42
Open price you set must differ from market price by at least 0 points.
Place
Close #0 by #0
List1
Close by
Multiple Close By
List1
Multiple Close By
Order Execution
OK
Print
Please wait...
Order is being processed by the server

Modify Order
Level:
0
points
Level:
0
points
Copy as:
0
Copy as:
0
Stop Loss:
0
Spin1
Take Profit:
0
Spin1
Modify #0 buy 0.00  sl: 0 tp: 0
Stop Loss or Take Profit you set must differ from market price by at least 0 points.
Modify Order
Price:
0
Spin1
Stop Loss:
0
Spin1
Take Profit:
0
Spin1
Expiry:
2023.03.06 22:42
Modify
Delete
Open price you set must differ from market price by at least 0 points.

I am using AutoItX3.dll in MQL(Metatrader programming language) . So i used this code to try click button :

 

AU3_Init();
AU3_ControlClick("Order","","65535","left",1,312,92);

But after running expert advisor "Order" window is just closing without clicking Buy by Market button. 

I have tried another way . I deselected Use Spy++ Control Detection Logic in Autoit Window Tool and here is summary on Buy by Market button :

>>>> Window <<<<
Title:  Order
Class:  #32770
Position:   44, 174
Size:   769, 387
Style:  0x94CA00C4
ExStyle:    0x00010101
Handle: 0x001427FE

>>>> Control <<<<
Class:  Button
Instance:   9
ClassnameNN:    Button9
Name:   
Advanced (Class):   [CLASS:Button; INSTANCE:9]
ID: 1036
Text:   Buy by Market
Position:   540, 227
Size:   188, 23
ControlClick Coords:    89, 12
Style:  0x5001000B
ExStyle:    0x00000004
Handle: 0x000A27BA

>>>> Mouse <<<<
Position:   681, 443
Cursor ID:  0
Color:  0x000000

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<
Symbol:
BTCUSD, BitCoin vs US Dollar
Volume:
1.00
1.00
Stop Loss:
0.00
Spin1
Take Profit:
0.00
Spin1
Comment:
Type:
Market Execution
Sell by Market
Buy by Market
Attention! The trade will be executed at market conditions, difference with requested price may be significant!
Market Execution 
22476.23 / 22571.99


>>>> Hidden Text <<<<
Sell
Buy
Enable maximum deviation from quoted price
Maximum deviation:
0
pips
Instant Execution 
22480.17 / 22576.32
Request Execution 
Request
Sell
Buy
Please request
Pending Order
Type:
Buy Limit
BTCUSD 1.00
at price:
0.00
Spin1
Expiry:
2023.03.06 22:55
Open price you set must differ from market price by at least 0 points.
Place
Close #0 by #0
List1
Close by
Multiple Close By
List1
Multiple Close By
Order Execution
OK
Print
Please wait...
Order is being processed by the server

Modify Order
Level:
0
points
Level:
0
points
Copy as:
0
Copy as:
0
Stop Loss:
0
Spin1
Take Profit:
0
Spin1
Modify #0 buy 0.00  sl: 0 tp: 0
Stop Loss or Take Profit you set must differ from market price by at least 0 points.
Modify Order
Price:
0
Spin1
Stop Loss:
0
Spin1
Take Profit:
0
Spin1
Expiry:
2023.03.06 22:55
Modify
Delete
Open price you set must differ from market price by at least 0 points.

After this i used below code in MQL :

AU3_Init();
AU3_ControlClick("Order","Buy by Market","1036","left",1,89,12);

Again after running expert advisor "Order" window is just closing without clicking Buy by Market button.

What i am doing wrong and what i must do to click Buy by Market button on a "Order" window on Metatrader 4 software ?

Thanks for answers.

1.jpg

Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...