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

 
Andrey Sokolov:

Greetings, could you give me a hint? MT5.

I need to get the values of Bollinger Bands.

I write

Outputs something similar to double_max.

At the same time it gets period, offset, and everything else correct.

Wouldn't it be easier to use iBands()?

Документация по MQL5: Технические индикаторы / iBands
Документация по MQL5: Технические индикаторы / iBands
  • www.mql5.com
iBands - Технические индикаторы - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Artyom Trishkin:

Wouldn't it be easier to use the usual iBands()?

When using a class, the writing is minimal.

Can you tell me how to get the data when using a class?

 
Andrey Sokolov:

Greetings, could you give me a hint? MT5.

I need to get the values of Bollinger Bands.

I write

Outputs something similar to double_max.

At the same time it gets period, offset, and everything else correct.



The data is not ready in Oninit yet!

 
PapaYozh:

Oninit isn't ready yet!

That is not the reason, sir.

 
Andrey Sokolov:

That is not a reason, sir.


Lack of data is "not a reason" for what?

 

Create

Creates an indicator with the specified parameters. UseRefresh() andGetData() to refresh and retrieve indicator values.


GetData

Gets the specified element of the indicator buffer.Refresh() should be called before using it to work with actual data.


Refresh

Refresh indicator data. It is recommended to call before usingGetData().

Документация по MQL5: Стандартная библиотека / Индикаторы / Базовые классы / CIndicator / Refresh
Документация по MQL5: Стандартная библиотека / Индикаторы / Базовые классы / CIndicator / Refresh
  • www.mql5.com
Refresh(const int) - CIndicator - Базовые классы - Индикаторы - Стандартная библиотека - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Andrey Sokolov:

When using a class, the writing is minimal.

Can you tell me how to get data when using a class?

Right... Minimal writing and maximum headache...

 
I am certainly no GURU. Far from it, even. But! Classes that can be applied and changed on a whim are maybe good for toys. But for serious stuff, it's BAD. Sorry.
 
Сергей Таболин:
Classes that can be applied and changed at a whim - that might be good for toys.

What kind of classes are these?

 
PapaYozh:

What are these classes?

As I, a dilettante, who can't understand the sacred meaning of all classes, and why OOP is needed in our (trading) business in general, I understand - classes are all written (both by MQ and guru) code-libraries, designed to "facilitate" life for "non-guru code-writers".

The trouble is, as I've already said, that using all this "relief" doesn't make writing code any easier. Because you always have to double-check all the orders you send yourself! Because practically everyone insists on me checking some "transactions" too. All the more so because these "...shares" come at random.

I give the order - to hammer a nail in this place at such an angle. That's it. Next I get a reply - the nail is hammered in. And then I get a warning that:

  • maybe the nail was the wrong size - need to check.
  • Maybe it's the wrong angle - need tocheck.
  • Maybe it's hammered in the wrong place - need tocheck.

So why do I need such performers (classes)?

I may be exaggerating a little, but the point doesn't change.

And why? Because any data processed in classes can be changed so that this class won't even suspect about the switch.

Reason: