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

 
O-Yama:
I wanted to try to use obj_rectangle_label, but no text is written on top.

First obj_rectangle_label and then OBJ_LABEL on top in the right place

 
MakarFX:

First obj_rectangle_label and then OBJ_LABEL on top in the right place

In my opinion it's better to use resources...

 
MakarFX:

First obj_rectangle_label and then OBJ_LABEL on top in the right place

Will obj_rectangle_label not overlap the inscription itself? Do I need to set any additional properties for the objects or any priorities for the shapes?
 
O-Yama:
Another option - one huge button, but the anchor text in it at the bottom in the middle (I would like it to be centered), how to change this - do not know yet, and whether it is possible.

I have the binding automatically centered


 
O-Yama:
Will obj_rectangle_label not overlap the inscription itself? Do I need to set any additional properties for objects or any priorities for shapes?

Creation order

MakarFX:

First obj_rectangle_label and then OBJ_LABEL on top at the desired location

 
Alexey Viktorov:

In my opinion, it is better to use resources...

Can I please be more specific...I don't understand what you mean?
 
MakarFX:

Creation order

Thank you so much! It's strange that I couldn't do it that way, either the methac was blunt, or I should have done a chart redraw or something else). You helped me a lot!
 

How can I count the number of all ticks on each OnTick() event for the last 10 seconds?


#property copyright "Copyright 2021, MetaQuotes Software Corp."

#property link      "https://www.mql5.com"

#property version   "1.00"

MqlTick Tick_Mql[];

void OnTick()

  {

ulong ten_msc = TimeCurrent() - 10000;

int TickLength = CopyTicks(_Symbol,Tick_Mql,COPY_TICKS_ALL,ten_msc,0);

  }


This code does not count correctly (TickLength increases by one with each new event)

 
MakarFX:
Can I be more specific, please... I don't understand what you mean?

There's nothing supernatural about it. The usual OBJ_BITMAP_LABEL and into it whatever you want as a resource. Kanvas works in OBJ_BITMAP_LABEL, too.

But your version is much easier for a novice developer.

 
Boris:

How can I count the number of all ticks on each OnTick() event for the last 10 seconds?

#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
MqlTick Tick_Mql[];
void OnTick()
 {
  ulong ten_msc = TimeCurrent() - 10000;
  int TickLength = CopyTicks(_Symbol,Tick_Mql,COPY_TICKS_ALL,ten_msc,0);
 }

This code doesn't count correctly (TickLength increases by one with each new event)

Please learn how to insert code into message.

And on question: Read documentation on CopyTicksRange

int  CopyTicksRange(
   const string     symbol_name,           // имя символа
   MqlTick&         ticks_array[],         // массив для приёма тиков
   uint             flags=COPY_TICKS_ALL,  // флаг, определяющий тип получаемых тиков
   ulong            from_msc=0,            // дата, начиная с которой запрашиваются тики
   ulong            to_msc=0               // дата, по которую запрашиваются тики
   );
Reason: