Need help to code my control panel MQL4 to run the time in actual

 

Hi everyone, 

Can anyone help me to code this concern issue...Time is freeze when i open the EA program. Time does not run in actual..

this is the actual output of EA mq4

dashboard panel

this is the code in .mqh

#include <Controls\Dialog.mqh>
#include <Controls\Label.mqh>
#include <Controls\Button.mqh>
#include <Controls\TimeFrames.mqh>
//-------
// Inputs
//-------
input group "==DASHBOARDPANEL Inputs=="
static input int InpPanelWidth = 190;
static input int InpPanelHeight = 170;
static input int InpPanelFontsize = 11;
static input int InpPanelTxtColor = clrKhaki;
//-------
// Class Panel
//-------
class CDashboard : public CAppDialog
{
 
 private:
   //---private methods
   CLabel m_lSymbol, m_lTimeframe, m_lDateTime;
   
   bool CheckInputs();
   bool CreatePanel();

 public:
 
             CDashboard (void);
            ~CDashboard (void);
      bool       OnInit(void);
      bool       OnDeinit(); 
      
      //----chart event handlers  
      void PanelChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam);
      ENUM_TIMEFRAMES   Period(void) const { return(ChartPeriod(m_chart_id)); }
};
//---constructor
void CDashboard::CDashboard(void){}
//---deconstructor
void CDashboard::~CDashboard(void){}
//-------
bool CDashboard::OnInit(void)
{
  
  if(!CheckInputs())
    {
    return(false);
    }
    //create panel
  if(!this.CreatePanel()){return(false);}
  
  return (true);
}
//---checkinputs
bool CDashboard::CheckInputs(void)
{
 if(InpPanelWidth<=0)
    {
    Print("PanelWidth <= 0 ");
    return(false);
    }
 if(InpPanelHeight<=0)
    {
    Print("PanelHeight <= 0 ");
    return(false);
    }
  if(InpPanelFontsize<=0)
    {
    Print("PanelFont Size <= 0 ");
    return(false);
    }  
  
      
 return(true);
}
//-------
bool CDashboard::CreatePanel(void)
{
 
     //---create dialog panel
      this.Create(NULL,"Dashboard",0,0,0,InpPanelWidth,InpPanelHeight);
      
      
      m_lSymbol.Create(NULL,"lSymbol",0,5,5,1,1);
      m_lSymbol.Text(_Symbol +":");
      m_lSymbol.Color(clrGold);
      this.Add(m_lSymbol);
      
      m_lTimeframe.Create(NULL,"lTimeframe",0,50,5,1,1);
      m_lTimeframe.Text(EnumToString(Period()));
      m_lTimeframe.Color(clrWhiteSmoke);
      m_lSymbol.FontSize(10);
      this.Add(m_lTimeframe);
     
      m_lDateTime.Create(NULL,"lDateTime",0,125,5,1,1);
      m_lDateTime.Text(TimeToStr(TimeCurrent(),TIME_SECONDS));
      m_lDateTime.Color(clrWhiteSmoke);
      this.Add(m_lDateTime);
   
      
      //---run panel
       if(Run()){Print ("Failed to run panel");return(false);}
        //---refresh chart
        ChartRedraw();
   
   return (true);
   
}
//-------
void CDashboard::PanelChartEvent(const int id,const long &lparam,const double &dparam,const string &sparam)
{
  //---call chartevent method of base class
  ChartEvent(id,lparam,dparam,sparam);

}

Hope someone can help me to solve this issue.. thank you.

 
//Call this in the OnTick() function of your EA

m_lDateTime.Text(TimeToStr(TimeCurrent(),TIME_SECONDS))
 
Osazee Asikhemhen #:

what is the code to call in the OnTick() function of EA


//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
 
  }

thank you for your response..

 
Christian Detera #: what is the code to call in the OnTick() function of EA. thank you for your response..
You don't call OnTick(). It is an event handler called by the terminal.
 
Fernando Carreiro #:
You don't call OnTick(). It is an event handler called by the terminal.

what event handler code should i encode? where to put it? is it on EA program? or in my include mqh program?

 
Christian Detera #: what event handler code should i encode? where to put it? is it on EA program? or in my include mqh program?

Do you even know how to code?

Is your code sample above not your own code?

Where did you get it from then?

 
Fernando Carreiro #:

Do you even know how to code?

Is your code sample above not your own code?

Where did you get it from then?

its my own code. i just follow the code in mql dialog sample code.. sorry i'm just a newbie here..my knowledge in programming is not well good.