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

 
Artyom Trishkin:

No one's going to look at those kind of shirts.


Then what is there to look at? "The "tartan" is the Murrey-levels-system indicator (I think many people know it). The question was how to properly "extract" from it

the right data for iCustom().

 
psyman:

Why can't I use a dynamic array?

In this case I have the closing price overwritten there without any calculation.

Where can I read how to use indicator buffers?

It is available here: https://book.mql4.com/ru/samples/icustom

Создание пользовательских индикаторов - Простые программы на MQL4 - Учебник по MQL4
Создание пользовательских индикаторов - Простые программы на MQL4 - Учебник по MQL4
  • book.mql4.com
При создании торговой стратегии у разработчика часто возникает необходимость графически отобразить в окне финансового инструмента некоторую зависимость, рассчитанную пользователем (программистом). Для этой цели в языке MQL4 предусмотрена возможность создания пользовательских индикаторов. Пользовательский индикатор - это программа, составленная...
 

It tells you how to do calculations and pass them to the terminal for display.

I don't have intermediate calculations output anywhere, so my school programming knowledge tells me that a dynamic array that increases on every i++ is sufficient for this.

Why to use a buffer for that is a mystery to me and I don't have an answer yet.

 
psyman:

Why can't I use a dynamic array?

In this case I have the closing price overwritten there without any calculation.

Where can I read how to use indicator buffers?

You may use it. But before you write it, its size should be increased. You can read it in the documentation. You have declared one buffer in your indicator.

psyman:

They tell you how to make calculations and send them to the terminal for displaying.

I don't output intermediate values anywhere, so my school programming skills tell me that a dynamic array that's incremented for every i++ is enough.

Why to use a buffer for that is a mystery to me and I don't have an answer yet.

Only the size of the indicator buffer array is increased automatically with each i++.
IndicatorBuffers - Пользовательские индикаторы - Справочник MQL4
IndicatorBuffers - Пользовательские индикаторы - Справочник MQL4
  • docs.mql4.com
Количество буферов не может превышать 512, а также не может быть меньше значения, указанного в свойстве #property indicator_buffers. Если пользовательский индикатор требует дополнительных буферов для расчета, то необходимо использовать функцию IndicatorBuffers() для указания общего числа буферов...
 

= You can read it in the documentation.


Please give me the link.

I addedSetIndexBuffer(1, tmp1), but nothing has changed.

As far as I understand, when an array is assigned a buffer, it is addressed as an array with the same name, but it's actually a buffer. Is it so?

 
psyman:

= You can read it in the documentation.


Please give me the link.

I added SetIndexBuffer(1, tmp1), but nothing has changed.

As far as I understand, when an array is assigned a buffer, it is addressed as an array with the same name, but it's actually a buffer. Right?

Note

The number of buffers cannot exceed 512, and cannot be less than the value specified in the #property indicator_buffers property. If the custom indicator requires additional buffers for calculation, you must use IndicatorBuffers() to specify the total number of buffers.

And then there is an example. If there is one buffer for display and need one for calculations, then IndicatorBuffers should have 2 and only then SetIndexBuffer(1, tmp1); while declaring the array at global variable level beforehand.

 
Anatoliy Ryzhakov:

What's looking at here, then? "The scuttlebutt is the Murrey-levels-system indicator (I think many people know it). The question was how to properly "extract" from it

the right data for iCustom().

Once again. Look carefully at the picture:


 
psyman:

Why can't I use a dynamic array?

In this case I have the closing price overwritten there without any calculation.

Where can I read how to use indicator buffers?

You don't understand something!

Adynamic array is used to record dynamic data (i.e. incoming quotes, time, etc.).

Dynamic arrays should not be used in calculations.

So, it's simple - EITHER YOU WRITE - OR YOU COMPUTE !!!

I hope this is clear (!!!???)

If we are talking about indicators, then indicators (generally speaking!) should be EXCEEDED. But in MT4/MT5 we don't see that!

In MT4/MT5 all indicators are dynamic. (Or there are others? - I don't know. I haven't checked them all, but I haven't seen others).

I don't know, is it good or bad - I am not judging.

The standard indicators in MT4/MT5 are all dynamic (if I am wrong, let me be corrected! But I have not seen others).

Therefore, before solving your problem it should be formulated.

What do you want to RECORD or EXACT ???

And after that decide which arrays you want.

I hope I've made it clear.

 
neverness:

You don't understand something!

A dynamic array is used to record dynamic data (i.e. incoming quotes, times, and so on).

Dynamic arrays should not be used in calculations.

So, it's simple - EITHER YOU WRITE - OR YOU COMPUTE !!!

I hope this is clear (!!!???)

If we are talking about indicators, then indicators (generally speaking!) should be calculated. But in MT4/MT5 we don't see that !

I don't know, is it good or bad - I will not judge.

The standard indicators in MT4/MT5 are all dynamic (if I am wrong, let me be corrected! But I have not seen others).

So, before solving your problem it should be formulated.

What do you want to RECORD or EXACT ???

And after that decide which arrays you want.

I hope I've made it clear.

But it's not right.

Who prevents you from using a dynamic array for calculations? The size of a dynamic array (if it's NOT an indicator buffer, which is monitored by a subsystem) must be watched by yourself, and you can change its size if necessary. But a static array always has a predefined size - it all depends on the task.

If we are talking about indicators, the indicators (generally speaking!) should be calculated. But in MT4/MT5 we do not see that!

What kind of unfounded nonsense is this? Indicators in their vast majority do nothing but calculate and display the necessary and sufficient amount of calculated data. All the time, on every tick.

What's with all the invective? From ignorance? Then it is better to remain silent. Then people will say they read it on the official MK forum. Are you deliberately creating a lie?

 

I created a variable in private

I try to work with it in a class method

it says the variable is not declared

???

Reason: