Need Help with Code to insert Dashboard in Use Interface Dialog

 

Hello

I have created an EA Dashboard now i want to insert it in a Dialog, Below is code for Dashboard and GUI( Graphical User Interface)



//+------------------------------------------------------------------+
//|                                                          TTB.mq4 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window

#include <Controls\Dialog.mqh>
CAppDialog  TTForex;

//+------------------------------------------------------------------+
//| Create User interface                                            |
//+------------------------------------------------------------------+
int OnInit()
  {
  
   ChartSetInteger(0,"",CHART_EVENT_MOUSE_MOVE,true);
   TTForex.Create(0,"TTForex",0,50,10,500,800);
  
   TTForex.Run();
   

   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---
   
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {
 TTForex.OnEvent(id,lparam,dparam,sparam);
 
  }
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   TTForex.Destroy(reason);
   
  }
//+------------------------------------------------------------------+
//|                                                        Testw.mq4 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict



string symlist[28]             = {"AUDCAD", "AUDCHF", "AUDJPY", "AUDNZD", "AUDUSD", "CADCHF","CADJPY", "CHFJPY", "EURAUD", "EURCAD", "EURCHF", "EURGBP", "EURJPY", "EURNZD",
                                  "EURUSD", "GBPAUD", "GBPCAD","GBPCHF",  "GBPJPY", "GBPNZD", "GBPUSD", "USDZAR", "NZDJPY", "NZDUSD", "USDCAD", "USDCHF","USDJPY","USA30"};
                                  
                                 
extern int horizontal                  =  50;
extern int vertical                    =  50;

         string symbol;
         int    count,bars;                                   


//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
    count = ArraySize(symlist);   
   
//---

         int i;
         
         if(bars !=Bars)
           {
            ObjectsDeleteAll();
            
            
            for( i=0;i<count;i++)
              {
               
               
               symbol = symlist[i];
               
                       
               
               
               
               
               button(symbol + i, symbol, 60, 18, 10, vertical + (i*22), Blue, White);
               
               button("Level"  +symbol,  "Level", 80, 18, 80, vertical +(i*22), Lime,Black);
               
               button("Sell"  +symbol,  "Level", 80, 18,170 , vertical +(i*22), Red,Black);
               
               button("PF"  +symbol,  "PF", 80, 18,260 , vertical +(i*22), White,Black);
             
               
           
              }
          
              
        
           }
            



   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  
         ObjectsDeleteAll();
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
   
  }
//+------------------------------------------------------------------+
//| ChartEvent function                                              |
//+------------------------------------------------------------------+
void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {

   
  }
  
//+------------------------------------------------------------------
//|                                                                 |
//+------------------------------------------------------------------


//+------------------------------------------------------------------+
void button(string but_name, string label, int xsize, int ysize, int xdist, int ydist, int bcolor, int fcolor)
{

            if(ObjectFind(0, but_name)<0)
              {
               
               if(!ObjectCreate(0, but_name, OBJ_BUTTON, 0, 0, 0))
                 {
                  Print(__FUNCTION__,
                        ": failed to create the button! Error code = ", GetLastError());
                        return;
                 }
                   
               ObjectSetString(0, but_name,OBJPROP_TEXT, label);
               ObjectSetInteger(0, but_name,OBJPROP_XSIZE, xsize);
               ObjectSetInteger(0, but_name,OBJPROP_YSIZE, ysize);
               ObjectSetInteger(0, but_name,OBJPROP_CORNER, CORNER_LEFT_UPPER);
               ObjectSetInteger(0, but_name,OBJPROP_XDISTANCE, xdist);
               ObjectSetInteger(0, but_name,OBJPROP_YDISTANCE, ydist);
               ObjectSetInteger(0, but_name,OBJPROP_BGCOLOR, bcolor);
               ObjectSetInteger(0, but_name,OBJPROP_COLOR, fcolor);
               ObjectSetInteger(0, but_name,OBJPROP_FONTSIZE, 9);
               ObjectSetInteger(0, but_name,OBJPROP_HIDDEN, true);
               ObjectSetInteger(0, but_name,OBJPROP_BORDER_COLOR, ChartGetInteger(0,CHART_COLOR_FOREGROUND));
               ObjectSetInteger(0, but_name,OBJPROP_BORDER_TYPE, BORDER_RAISED);
               
               
               
               ChartRedraw();
               
              }

}
Files:
Testw.mq4  5 kb
DD.mq4  5 kb
Interface.JPG  142 kb
 
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.

 
Keith Watford:
Topics concerning MT4 and MQL4 have their own section.
In future please post in the correct section.
I have moved your topic to the MQL4 and Metatrader 4 section.

Oh sorry my Bad I didn't know , thanks for the advise
Reason: