Download MetaTrader 5
To add comments, please log in or register
Have you found an interesting application? Publish it in Code Base - millions of traders will appreciate that!
marcelo marques pereira
75
marcelo marques pereira 2015.03.27 16:26 

Hi Guys!

I just coded a "Buy button" in my EA using the feature "OBJ_BUTTON"

ObjectCreate(0,aux_Button_name,OBJ_BUTTON,0,xposition,yposition);

and put it into the "OnChartEvent"  for when I click on it, the EA issues an order.. It works on Demo/Live ,  however when I run it over the Strategy Tester it remains pressed and and does not issue any order..

Does anyone know how to make it works  with the Strategy Tester?

 

Many thanks

honest_knave
951
honest_knave 2015.03.27 18:14  

A workaround I have used in the past is to check the button state each tick:

ObjectGetInteger(0,aux_Button_name,OBJPROP_STATE)

 If it is true, run what ever you need then reset the button state to false using:

ObjectSetInteger(0,aux_Button_name,OBJPROP_STATE,false);

 

You can use IsVisualMode() to avoid unnecessary processing under normal operation.

marcelo marques pereira
75
marcelo marques pereira 2015.03.28 11:28  
honest_knave:

A workaround I have used in the past is to check the button state each tick:

 If it is true, run what ever you need then reset the button state to false using:

 

You can use IsVisualMode() to avoid unnecessary processing under normal operation.

 

Thank you  honest_knave

thaI did that before and it does work ..howecer it consumes more processor  right? :  ) but it works for sure! : )

Thanks a million for replying my post, and have a nice weekend! 

/
To add comments, please log in or register