Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1039

 

I'm drawing my indicator panel. I have a question, how to make it non-transparent for other lower graphical objects.

Some lines jump out (the mouse catches) and try to change their position.

In general, how to make the panel is not visible to the objects that it covers?



Fig. 1

 
Aleksandr Tyunev:

I'm drawing my indicator panel. I have a question, how to make it non-transparent for other lower graphical objects.

Some lines jump out (the mouse catches) and try to change their position.

In general, how to make the panel is not visible to the objects that it covers?



I'm not exactly sure (as it looks like you're creating your panel using the library) - if possible, you should give the panel a higher priority on receiving mouse clicks with this function

ObjectSetInteger(ChartID(),name,OBJPROP_ZORDER,z_order);
 
jaffer wilson:

Two statements:

Print: 22.33

И

Print: 2.00000

Why are there different outputs? In C / C ++ the above statement works fine.

even in C, formatting
"%.*lf"

slightly different from what you imagined :-)

the first argument is precision (it's like an asterisk there), you probably thought the opposite, and getting "2.0000" you're surprised

PS/ don't learn MQL programming.

 
Alexandr Sokolov:

I'm not exactly sure (since it looks like you're creating your panel using the library) - if it's possible, you need to give the panel a higher priority on receiving mouse clicks with this function

It doesn't matter library based or just object = OBJ_RECTANGLE_LABEL. Covering graph objects below the level, doesn't work.

 
Aleksandr Tyunev:

I'm drawing my indicator panel. I have a question, how to make it non-transparent for other lower graphical objects.

Some lines jump out (the mouse catches) and try to change their position.

In general, how to make a panel is not visible to the objects closed by it?

I remember there was a time, screwed around a bit over it)))

Option ready:

void OnChartEvent(const int id,
                  const long &lparam,
                  const double &dparam,
                  const string &sparam)
  {

if(id==CHARTEVENT_MOUSE_MOVE) { 
      
      int      x      =(int)lparam; // Координата по оси X
      int      y      =(int)dparam; // Координата по оси Y
      int      subwin =WRONG_VALUE; // Номер окна, в котором находится курсор
      datetime time   =NULL;        // Время соответствующее координате X
      double   level  =0.0;         // Уровень (цена) соответствующий координате Y
      string MState  =(string)sparam;  // Состояние левой кнопки мыши
      
      if (MState=="0") {
     //--- Получим местоположение курсора
      if(!::ChartXYToTimePrice(ChartID(),x,y,subwin,time,level))
         return;
     
     int obj_total=ObjectsTotal();
      for(int i=obj_total-1;i>=0;i--)
      {
      string name=ObjectName(i);
      // Для координат окна панели
      if (StringSubstr(name,5,10)=="ClientBack") {   // Ищем среди объектов больший (прямоугольник) с именем ClientBack (у меня так называется)
         
         int x_dist, x_size, y_dist, y_size;
         bool stop_selected_all;
         
         x_dist=ObjectGetInteger(ChartID(),name,OBJPROP_XDISTANCE,0);
         y_dist=ObjectGetInteger(ChartID(),name,OBJPROP_YDISTANCE,0);
         
         x_size=ObjectGetInteger(ChartID(),name,OBJPROP_XSIZE,0);
         y_size=ObjectGetInteger(ChartID(),name,OBJPROP_YSIZE,0);
         
         if (((x>x_dist-5)&&(x<x_dist+x_size+5))&&((y>y_dist-24)&&(y<y_dist+y_size))){
         ChartSetInteger(ChartID(),CHART_DRAG_TRADE_LEVELS,false);
         ChartSetInteger(ChartID(),CHART_MOUSE_SCROLL,false);
         //ObjectSetInteger(ChartID(),name,OBJPROP_ZORDER,1);
         //ObjectSetInteger(ChartID(),name,OBJPROP_BORDER_TYPE,BORDER_RAISED);
         if (stop_selected_all==false) {
            int obj_total_1=ObjectsTotal();
            for(int i=obj_total_1-1;i>=0;i--)
            {
            string name_1=ObjectName(i);
            ObjectSetInteger(ChartID(),name_1,OBJPROP_SELECTABLE,false);
            stop_selected_all=true;
            }
            }
         } else {
         ChartSetInteger(ChartID(),CHART_DRAG_TRADE_LEVELS,true);
         ChartSetInteger(ChartID(),CHART_MOUSE_SCROLL,true);
         //ObjectSetInteger(ChartID(),name,OBJPROP_ZORDER,0);
         //ObjectSetInteger(ChartID(),name,OBJPROP_BORDER_TYPE,BORDER_SUNKEN);
            int obj_total_1=ObjectsTotal();
            for(int i=obj_total_1-1;i>=0;i--)
            {
            string name_1=ObjectName(i);
            ObjectSetInteger(ChartID(),name_1,OBJPROP_SELECTABLE,true);
            stop_selected_all=false;
            }
         }
      }
      
      // End. Для координат окна панели
      }
      }
     
      return;
     }
  }

In general, the principle is this.

 
Vyacheslav Nekipelov:

I remember there was a time when I was struggling with this))

A variant of the finished one:

Basically, the principle is this.

Thank you! The principle is clear, I'll use it further!

 
The mql5 chm handbook does not work correctly for some reason. When I select this or that page, it doesn't show anything. What could be the reason and how to fix it?
 
Yevhenii Levchenko:
The mql5 chm handbook does not work correctly for some reason. When I select this or that page, it doesn't show anything. What could be the reason and how to fix it?

It is necessary to remove the lock in the file properties.

 
Please help. I have a tick indicator. For some reason it shows the value in 4 digits, but I need it in 5 digits.
#property  indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Aqua
double x[];
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int init()
  {
   IndicatorBuffers(1);
   SetIndexStyle(0,DRAW_LINE);
   SetIndexBuffer(0,x);
   SetIndexDrawBegin(0,0);
   SetIndexLabel(0,"x");
   SetIndexShift(0,0);
   return(0);
  }
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int start()
  {
   double b=MarketInfo(Symbol(),MODE_BID);
   x[0]=b;
   for(int j=ArraySize(x)-1;j>=1;j--){x[j]=x[j-1];}
   return(0);
  }
//+------------------------------------------------------------------+
Создание тиковых индикаторов
Создание тиковых индикаторов
  • www.mql5.com
При торговле хочется иметь как можно больше информации. Возникает желание видеть более детальную картину изменения цен. Для этого можно использовать тиковый график. Попробуем построить тиковый график средствами MQL5. В этой статье описывается создание двух индикаторов: строящего тиковый график цены и рисующего "тиковые свечи" - свечи...
Files:
ticks.png  4 kb
 
Oleg Bondarev:
Please help. There is a tick indicator. For some reason it shows a 4-digit value, while I need a 5-digit one.

IndicatorDigits(5)

Reason: