Download MetaTrader 5
To add comments, please log in or register
All MQL5.community events are grouped together. Have a look at the Wall!
MrChuckW
398
MrChuckW 2016.07.13 04:10 

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 2016.07.13 11:09  

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
13951
whroeder1 2016.07.13 14:48  
MrChuckW
398
MrChuckW 2016.07.14 03:09  
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