Buttons do manage different functions via chart

Back to topics list To post a new topic, please log in or register
avatar
3
JohnQ07 2016.06.11 13:22
 

Dear community,

I am looking for a possibility to open/manage a trade via buttons on the chart.

Creating a button is not the problem but to link it with a function is a problem.

One example what  I want to programm is - if I push a button - call it BUY then should appear a field with different inputfields like SL,TP, Risk in %...

After one has filled the fields you and you push OK a long trade is opened...


An other questions is how can I change bool variables with a button on a chart

eg. in your ea is a trailingstopp included an you decide to use it or not - I would like to have a button TL-Stopp. If it is on the button shoud be green otherwise red...


Thank you for your response!

br,

John

avatar
Moderator
3411
GumRai 2016.06.11 14:22 #
 

Not a simple answer to this question fully.

Create OBJ_EDITs for your inputs, read the values with your code and send the order.

avatar
12992
avatar
3
JohnQ07 2016.06.11 22:29 #
 

Thank you for your answers - I will check the code of Money Manager...

br

John

avatar
16
Janek6191 2016.06.12 08:42 #
 

"One example what  I want to programm is - if I push a button - call it BUY then should appear a field with different inputfields like SL,TP, Risk in %..."

This is possible but harder than just making ever-visible buttons to change the variables.

Here is how it could look with visible fields. (arrows are just buttons, in the middle are rect-labels for background and on them are normal labels to display values)


"An other questions is how can I change bool variables with a button on a chart"

Simply make a global bool variable - in OnTick function do some actions according to if(variable){...}.

And if you want to change it do it in OnChartEvent() function. Here is example from my program (where "ReverseOnStop" is the object name):

if(sparam=="ReverseOnStop"){
         if(reverseOnStop){
            rev="OFF";
            reverseOnStop=false;
         }
         else{
            rev="ON";
            reverseOnStop=true;
         }
         ObjectSetString(chart_ID,"ReverseOnStop",OBJPROP_TEXT,"REVERSE ON STOP - "+rev);  
}
avatar
3
JohnQ07 2016.06.14 20:54 #
 

Thanks a lot for your answers - now I have to do trial and error - speek the usual things...

br,

John

Back to topics list  

To add comments, please log in or register