mql4 clickable buttons

Back to topics list To post a new topic, please log in or register
avatar
131
mrchuckw 2016.07.13 06: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. 

avatar
18
24hworker 2016.07.13 13: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);  }

              }

avatar
12984
avatar
131
mrchuckw 2016.07.14 05: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. 

Back to topics list  

To add comments, please log in or register