Columns are not displaying correctly on the chart

 

Hi,

I would like to create a dashboard with 28 rows and 14 columns using classes. However, I am having trouble with the 12th and 13th columns as they are not displaying correctly on the chart (please refer to the attached photo). I would greatly appreciate your help in resolving this issue.

Thank you.

#include <Controls\Dialog.mqh>
CAppDialog RsiAppDialog;
CPanel OurPanelArray[14][28];
int panelWidth=20,panelHeight=20;
int AppDialogTop=10,AppDialogLeft=30,AppDialogWidth=300,AppDialogHeight=600;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   RsiAppDialog.Create(0,"RsiAppDialog",0,AppDialogLeft,AppDialogTop,AppDialogLeft+AppDialogWidth,AppDialogTop+AppDialogHeight);
   CreatePanels();
//   RsiAppDialog.Add("OurPanel");
   RsiAppDialog.Run();
   return(INIT_SUCCEEDED);
  }

//+------------------------------------------------------------------+
//| Custom Indicator De-Initialization                               |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   RsiAppDialog.Destroy(reason);
  }

//+------------------------------------------------------------------+
//| 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)
  {
//---
   RsiAppDialog.OnEvent(id,lparam,dparam,sparam);
  }
//+------------------------------------------------------------------+
//|  Function to create panels                                       |
//+------------------------------------------------------------------+
void CreatePanels()
  {
   int left=0;
   int right=left+panelWidth;
   int top =0;
   int bottom =top+panelHeight;

   for(int i=0; i<14; i++)
     {
      for(int j=0; j<28; j++)
        {
         OurPanelArray[i][j].Create(0,string(i)+string(j),0,left,top,right,bottom);
         OurPanelArray[i][j].ColorBackground(clrGray);
         OurPanelArray[i][j].ColorBorder(clrBlack);
         RsiAppDialog.Add(OurPanelArray[i][j]);
         top+=panelHeight;
         bottom+=panelHeight;
        }
      top=0;
      bottom=top+panelHeight;
      left+=panelWidth;
      right=left+panelWidth;

     }
  }
 
Any help pls?
 
dionusos #:
Any help pls?

Name collisions :

string(i)+string(j)

Example : When i = 11 and j=0 you have the same name as when i=1 and j=10.

 

Hi Allain,

Thank you very much for your help. It turned out to be so simple after all.

I just had to transform the "string" to "DoubletoStr" and the result was wonderful (see photo attached).

Once again, I would like to express my gratitude for your assistance.

 
dionusos #: I just had to transform the "string" to "DoubletoStr" a

Don't do that. Someone searching might find this thread and still be clueless. What solved what?

How To Ask Questions The Smart Way. (2004)
     When You Ask.
          Follow up with a brief note on the solution.

You could have also changed
string(i)+string(j)
to
string(i)+"_"+string(j)
 
"Don't do that. Someone searching might find this thread and still be clueless. What solved what? "

Thank you for your reply, William.

However, in order to eliminate the warning message "implicit conversion from 'number' to 'string'", it would be wrong to use the function, "IntegerToString()" at the next line? 

OurPanelArray[i][j].Create(0,IntegerToString(i)+" "+ IntegerToString(j),0,left,top,right,bottom);
Columns are not displaying correctly on the chart
Columns are not displaying correctly on the chart
  • 2023.03.03
  • www.mql5.com
Hi, I would like to create a dashboard with 28 rows and 14 columns using classes...