Questions from Beginners MQL5 MT5 MetaTrader 5 - page 703

 
-Aleks-:

I guess I'm not explaining myself very well... I am drawing a time-based object, i.e. the first point is the start of the day and the second is the start of the next day.

I need to know for any upper TF:

1. How many objects may be drawn in total on the current TF, taking into account that one object per one bar of the upper TF

2. Where the object starts and ends

Yes, I've studied it, but it's too long to use CopyTime() - is there no simpler option?

Analogue of iTime() is needed.

This is an analogue, only in different letters.
 
Renat Akhtyamov:
this is the analogue, only in different letters.

I understand, but I don't realise it yet...

Such a question, when connected to a trading server, how much load do you have on your CPU? I have tools 10, no robots or indicators - load up to 35% Phenom II 960T 5 cores 3500Mhz. If the terminal is this voracious, I'll lose the point of messing around with it at all...

 
-Aleks-:

I understand, but I don't realise it yet...

Such a question, when connected to a trading server, how much load do you have on your CPU? I have tools 10, no robots or indicators - load up to 35% Phenom II 960T 5 cores 3500Mhz. If the terminal is this voracious, I'll lose the point of fiddling with it at all...

g take a look here: https://www.mql5.com/ru/forum/99230

might help

Загрузка процессора на МТ5 = 15-50 %, SVChost, Обновление Windows: РЕШЕНО
Загрузка процессора на МТ5 = 15-50 %, SVChost, Обновление Windows: РЕШЕНО
  • www.mql5.com
Всем привет друзья. Хотелось бы узнать у Вас. в каких случаях у Вас загрузка процессора от терминала мт5 достигает до 50...
 
-Aleks-:

I guess I'm not explaining myself very well... I am drawing a time-based object, i.e. the first point is the start of the day and the second is the start of the next day.

I need to know for any upper TF:

1. How many objects may be drawn in total on the current TF, taking into account that one object per one bar of the upper TF

2. Where the object starts and ends

Yes, I've studied it, but it's too long to use CopyTime() - is there no simpler option?

I need iTime() analogue.

You explain it very badly. I don't understand anything, maybe you can draw me a picture, step by step?

  1. Answer: zero. Since on the top (as I understand it is PERIOD_D1) you have one object: ". the first point is the beginning of the day, and the second is the beginning of the next day".
  2. See point 1.

Function for getting the opening time of bars:

//+------------------------------------------------------------------+
//| Get Time for specified bar index                                 |
//+------------------------------------------------------------------+
datetime iTime(const int index,string symbol=NULL,ENUM_TIMEFRAMES timeframe=PERIOD_CURRENT)
  {
   if(symbol==NULL)
      symbol=Symbol();
   if(timeframe==0)
      timeframe=Period();
   datetime Time[1];
   datetime time=0;
   int copied=CopyTime(symbol,timeframe,index,1,Time);
   if(copied>0) time=Time[0];
   return(time);
  }


Example call (if for current symbol and current timeframe)

datetime time=iTime(0); // врем открытия бара №1
 
Vladislav Andruschenko:

g look here: https://www.mql5.com/ru/forum/99230

might help

Right, you had the same problem - even put it in my favourites then - forgot - thanks - I'll give it a try!
 
Vladimir Karputov:

You explain it very badly. I don't understand anything, can you draw pictures, step by step?

  1. Answer: zero. Since on the top (as I understand it PERIOD_D1) you have one object: ". the first point is the beginning of the day, and the second is the beginning of the next day".
  2. See number 1.

How is it zero?

Here is a screenshot of how it should be:

 
Vladimir Karputov:

Function to get the bar open time:

//+------------------------------------------------------------------+
//| Get Time for specified bar index                                 |
//+------------------------------------------------------------------+
datetime iTime(const int index,string symbol=NULL,ENUM_TIMEFRAMES timeframe=PERIOD_CURRENT)
  {
   if(symbol==NULL)
      symbol=Symbol();
   if(timeframe==0)
      timeframe=Period();
   datetime Time[1];
   datetime time=0;
   int copied=CopyTime(symbol,timeframe,index,1,Time);
   if(copied>0) time=Time[0];
   return(time);
  }


Example call (if for current symbol and weaving timeframe)

datetime time=iTime(0); // врем открытия бара №1
Thanks - I'll try it out - as soon as I get over feeling frustrated.
 
-Aleks-:

What do you mean, zero?

Here's a screenshot of how it should be:

The picture does not fit the description"the first point is the beginning of the day, and the second is the beginning of the next day".

Judging by the picture, you need to draw two objects on any timeframe (on any timeframe smaller than PERIOD_D1), and the time coordinates of these two objects must be within one day:

Outline

Am I understanding this correctly?

 
Vladimir Karputov:

The picture does not fit the description"the first point is the beginning of the day, and the second is the beginning of the next day".

Judging by the picture, you need to draw two objects on any timeframe (on any timeframe smaller than PERIOD_D1) - and by time coordinates these two objects must be within ONE day:

Am I reading this correctly?

It doesn't matter how many objects there are - there are more than two. The period is not necessarily limited to D1 - it is limited to a time interval multiple of any upper TF. The objects must be within the time interval - you are right.
 
-Aleks-:

I understand, but I don't realise it yet...

Such a question, when connected to a trading server, how much load do you have on your CPU? I have tools 10, no robots or indicators - load up to 35% Phenom II 960T 5 cores 3500Mhz. If the terminal is this voracious, I'll lose the point of messing around with it at all...

Nah, it's not too much of a drain. Just noticeable difference in speed of maths from 4k. I like the fact that there's a sort of automatic loading history.

However, I don't really like it yet.

In essence, it does not give you anything. You still have to synchronize different currency pairs, there are still holes.