Eventhandling in Tester environment

 

In Tester the onChartEvent() function does not work. You have to put event handling into the onTick() function.

If you define the buttons in OnInit() the event handling works.

 if(ObjectGetInteger(0,"CloseButton",OBJPROP_STATE)==true)
        {
         CloseOpenPosition();
         ObjectSetInteger(0,"CloseButton",OBJPROP_STATE,false);
        }

Problem: If there is some graphic from the chart behind the button it does not work.

I wanted therefore to put the buttons in a panel. But there is the same problem, event handling does not work in onChartEvent(). I have to reference the buttons in the panel from the onTick() function.

Question: How can I reference the button object from the onTick() function?


I just have an ExtDialog reference, I have not CAppWindowThreeButtons reference.

class CAppWindowThreeButtons : public CAppDialog
  {
protected:
   CPositionInfo     m_position;                      // trade position object
   CTrade            m_trade;                         // trading object
   CAccountInfo      m_account;                       // account info wrapper

private:
//public:
   CButton           m_button1;                       // the button object
   CButton           m_button2;                       // the button object
   CButton           m_button3;                       // the button object

If I create an instance of the class in onTick() 

CAppWindowThreeButtons caw;

it does not work.

Anybody has an idea howto event handling from panels in tester?


 

 

Hmm - Du wählst das deutsche Forum und schreibst englisch?

Aber zu Deinem Problem: Studiere doch einmal die Lösung, die hier mit Tasten auf dem Chart angeboten und erklärt hat: https://www.mql5.com/de/articles/5348

Entwicklung eines Symbolauswahl- und Navigationsprogramms in MQL5 und MQL4
Entwicklung eines Symbolauswahl- und Navigationsprogramms in MQL5 und MQL4
  • www.mql5.com
Erfahrene Händler sind sich der Tatsache bewusst, dass die meisten zeitaufwendigen Dinge im Handel nicht das Öffnen und Verfolgen von Positionen sind, sondern das Auswählen von Symbolen und das Suchen von Einstiegspunkten. Natürlich sind das keine großen Probleme, wenn man nur mit 1-2 Symbolen arbeitet. Aber wenn Ihr Handelsansatz Hunderte von...
 

Vielen Dank, nicht gecheckt, dass dieses Forum nur Deutsch ist.

In diesem Programm sind die Buttons direkt in der Applikation, da habe ich kein Problem, drauf zuzugreifen. Aber es ist eine gute Idee, in einer bestehenden Applikation zu suchen.

Wenn ich ein Panel erzeuge, fehlt mir eine Referenz auf die Buttons. 

Grund der Beschwerde: