Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1075

 
Anzhela Sityaeva:

So you have to list everything?

Either enumerate them all

or shift OBJ_ALL_PERIODS by a required number of bits (timeframes), it seems that in your case it must be shifted by 9 bits

OBJ_ALL_PERIODS >> 9
 
Igor Makanu:

either list them all

or shift OBJ_ALL_PERIODS by the required number of bits (timeframes), in your case it seems that 9 bits should be shifted

Igor, could you please describe the theory how to calculate how many bits to shift.

 
Alexey Viktorov:

Igor, could you please describe the theory of how to calculate how many bits to shift.

all TFs that can be generated by the terminal are written in the helphttps://www.mql5.com/ru/docs/constants/objectconstants/visible

constant OBJ_ALL_PERIODS is 1 1111 1111 1111 1111 1111 1111 i.e. all 1's

if we shift bitwise to the right, then the left side will be filled with zeros

count the number of TFs listed above OBJ_ALL_PERIODS , I counted 9 pieces, maybe one wrong - it is easy to check


SZZ: you can do a combination of shift + OR, and get to display all the TF and the one we deem necessary to add, something like that:


( OBJ_ALL_PERIODS >> 9 ) | OBJ_PERIOD_H4

it should be able to display everything below PERIOD_H1 and the TF PERIOD_H4

Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Видимость объектов
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Видимость объектов
  • www.mql5.com
Комбинация флагов видимости объекта определяет таймфреймы графика, на которых объект отображаем. Для установки/получения значения свойства OBJPROP_TIMEFRAMES можно использовать функции ObjectSetInteger()/ObjectGetInteger...
 
Igor Makanu:

all TFs that can be generated by the terminal are written in the helphttps://www.mql5.com/ru/docs/constants/objectconstants/visible

constant OBJ_ALL_PERIODS is 1 1111 1111 1111 1111 1111 1111 i.e. all 1's

if we shift bitwise to the right, then the left side will be filled with zeros

count the number of TFs listed above OBJ_ALL_PERIODS in the reference, I counted 9, maybe one wrong - it is easy to check

Thank you, but it's not a theory, it's more specific about the current case. So how did you calculate 9? Or have you calculated only for mql4... because in mql5 the periods are much longer.

 
Alexey Viktorov:

Thank you, but this is not a theory. This is a more concrete case. But how did you calculate 9? Or you have calculated only for mql4 ... Because there are much more periods in mql5.

I counted from the mql5 help and gave a link to mql5!

It's not theory, it's practice! And you like to argue - that's a fact! )))

ZZY: Your example with subtraction would work correctly, but you have to "start somewhere", I would start from OBJ_ALL_PERIODS again, deduct all unnecessary periods from it

OBJ_ALL_PERIODS   - OBJ_PERIOD_H2 - OBJ_PERIOD_H3 - OBJ_PERIOD_H4 - OBJ_PERIOD_H6 - OBJ_PERIOD_H8 - OBJ_PERIOD_H12 - OBJ_PERIOD_D1 - OBJ_PERIOD_W1 - OBJ_PERIOD_MN1

HH2 | OBJ_PERIOD_H3 | OBJ_PERIOD_H4 | OBJ_PERIOD_H6 | OBJ_PERIOD_H8 | OBJ_PERIOD_H12 | OBJ_PERIOD_D1 | OBJ_PERIOD_W1 | OBJ_PERIOD_MN1

can be calculated and used via #define

 
Igor Makanu:

I counted from the mql5 help and gave a link to mql5!

It's not theory, it's practice! And you like to argue - that's a fact! )))

ZZY: Your example with subtraction would work correctly, but you have to "start somewhere", I would start from OBJ_ALL_PERIODS again, deduct all unnecessary periods from it

HH2 | OBJ_PERIOD_H3 | OBJ_PERIOD_H4 | OBJ_PERIOD_H6 | OBJ_PERIOD_H8 | OBJ_PERIOD_H12 | OBJ_PERIOD_D1 | OBJ_PERIOD_W1 | OBJ_PERIOD_MN1

can be calculated and used via #define

When arguing, you don't put a question mark, while in my text you only put questions.

And now I understood where 9 comes from. Turns out it's a shift from the maximum... I was counting from the beginning.

Everything else is up to the individual.
 
Alexey Viktorov:

Now I understand where the 9 is coming from. Turns out to be a shift from the maximum... I was counting from the beginning.

There is no way to do it from the beginning - bitwise shifts always fill the vacated bits with zeros, in principle this problem can be solved with logical NOT - invert the bits, but I have no terminal - I don't remember how to do bitwise NOT in MQL, and I don't want to read online help

 
Igor Makanu:

it wouldn't work from the beginning - bitwise shifts always fill the vacated bits with zeros, in principle this problem can be solved with logical NOT - invert the bits, but I don't have a terminal - I don't remember how to do bitwise NOT in MQL, and I don't want to read online help

Igor, this is not serious. If you can't argue, it's just a flop. If you don't want to prove your point, you'd better not join the discussion at all...

 
Сергей Таболин:

Igor, this is not serious. If you can't make an argument, it's just a fluff piece. If you don't want to prove your point, then you'd better not engage in the discussion at all...

Hmm, what are we talking about? I have to prove that

OBJ_ALL_PERIODS >> 9

that I should set flags to 1 in all TFs described in help higher thanOBJ_ALL_PERIODS by counting 9 lines?

Get the basics of binary counting, it's obvious, I can't prove 2 x 2 = ?

;)

 
Igor Makanu:

hmm, what are we talking about? do i have to prove that

flags in 1 at all TFs that are described in the help thanOBJ_ALL_PERIODS?

go for the basics of binary counting, it's obvious, I can't prove 2 x 2 = ?

;)

That's not what I mean.

"And use logical NOT to solve - invert the bits, but I don't have a terminal - I don't remember how to do bitwise NOT in MQL, and I don't want to read the online help".

I mean either give me a proof or don't muddy the waters ))))

"Anybody can make a mistake. Only the strong can admit to a mistake!". If no one has voiced it yet, that's my wisdom ))). If someone has already said it, I have repeated the wisdom of the wise man ))))

Reason: