Download MetaTrader 5

mql4 clickable buttons

To add comments, please log in or register
MrChuckW
399
MrChuckW  

Can someone share with me simple code for mql4 to have a clickable button on a forex chart that when clicked places a market order?

If not the code, where to go to research. 

All my searches send me to mql5. 

Achim Rogalski
61
Achim Rogalski  

I think the idea behind your question is the possibility to confirm an automated trade by a click. 

So no order is places after you have confirmed it by a click on a button.

 

I would do it like this:

 

if(Indicator shows in the right direction)

          {

                PlaySound("ok.wav");     // you must be informed, if the button appears on the screen

                int answer = MessageBox("Shall order be placed ?","Expert Advisor XYZ",MB_YESNO);  // 6 is yes, 7 is no

                if(answer==6)

                     {  int ticket = OrderSend("EURGBP",OP_BUY,1.0,Bid,0,0,0,"XYZ",123,0,clrBlue);  }

              }

whroeder1
15062
whroeder1  
MrChuckW
399
MrChuckW  
24hworker:

I think the idea behind your question is the possibility to confirm an automated trade by a click. 

So no order is places after you have confirmed it by a click on a button.

 

I would do it like this:

 

if(Indicator shows in the right direction)

          {

                PlaySound("ok.wav");     // you must be informed, if the button appears on the screen

                int answer = MessageBox("Shall order be placed ?","Expert Advisor XYZ",MB_YESNO);  // 6 is yes, 7 is no

                if(answer==6)

                     {  int ticket = OrderSend("EURGBP",OP_BUY,1.0,Bid,0,0,0,"XYZ",123,0,clrBlue);  }

              }

this is awesome.   Has gotten me started.   Now I'm looking for ways to change the labels of the two buttons from Yes   No   to   Buy  Sell...   any ideas?   

And can it be specific to that chart window?

 

thanks again... great start. 

To add comments, please log in or register