Questions from Beginners MQL5 MT5 MetaTrader 5 - page 1165

 
Alexey Viktorov:

You can't lose a skill.

Yes? A hundred, then? With lemon...

 
Artyom Trishkin:

In the screenshot, the buffer display is shifted five bars to the right. So - to get the fifth bar of the indicator buffer (with index 4), and further down the list to the left, where should we get them from? From Buffer[4] and further to the left.

In theory. In practice I haven't opened the code of indicators for a long time, I haven't worked with them for almost a year. Give it a try.

That's right. But I don't need those 5 values on the right, I want to have necessary value in Buffer[0] at once. Otherwise I will have to pass not only the buffer but the offset as well into a bunch of functions to calculate fractals by MA and other stuff. This is an unnecessary complication of the code and extra slow-down of calculations.

I can copy required values into Buffer (without 5 MA values to the right) only if I pass -2*ma_shift into CopyBuffer for start_pos.
That's the original question - where did the double negative offset come from. Please clarify. Perhaps it is a bug, or maybe it is a feature of MQL5.

 
RickD:

This is correct. But I don't need those 5 values on the right, I want to have the desired value in Buffer[0] at once. Otherwise I will have to pass not only buffer, but shift as well into a bunch of functions for calculation of fractals by MA and other things. This is an unnecessary complication of the code and extra slow-down of calculations.

I can copy required values into Buffer (without 5 MA values on the right) only if I pass -2*ma_shift into CopyBuffer for start_pos.
That's the original question - where did the double negative offset come from. Please clarify. Perhaps it is a bug, or maybe it is a feature of MQL5.

You see that you are not understood. If you do so, you usually draw a picture. It's not clear yet WHAT you want to get.


Added: The picture should show WHAT the WHOLE result should be.

 
RickD:

This is correct. But I don't need those 5 values on the right, I want to have the desired value in Buffer[0] at once. Otherwise I will have to pass not only the buffer but also the offset into a bunch of functions for calculation of fractals by MA and other things. This is an unnecessary complication of the code and extra slow-down of calculations.

I can copy required values into Buffer (without 5 MA values to the right) only if I pass -2*ma_shift into CopyBuffer for start_pos.
That's the original question - where did the double negative offset come from. Please clarify. Perhaps it is a bug, or maybe it is a feature of MQL5.

The shift is simply a shift in the mask display. The rightmost value will be in Buffer[0]. If you want to know the value on the zero bar, it will be in Buffer[0 + shift].


If you want it without + shift, specify 0 + shift inCopyBuffer(), then Buffer[0] will contain the desired value.
 
Can you tell me which inluder to plug in to get to theMathCorrelationKendall() function ?
Документация по MQL5: Стандартная библиотека / Математика / Статистика / Вспомогательные функции / MathCorrelationKendall
Документация по MQL5: Стандартная библиотека / Математика / Статистика / Вспомогательные функции / MathCorrelationKendall
  • www.mql5.com
Стандартная библиотека / Математика / Статистика / Вспомогательные функции / MathCorrelationKendall - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Сергей Таболин:
Can you tell me which inluder to plug in to get to the MathCorrelationKendall() function ?

Connect:

#include <Math\Stat\Math.mqh>
 
Vladimir Karputov:

Connect:

Thank you.

 
If you want it without + shift, specify 0 + shift in CopyBuffer(), then Buffer[0] will contain required value.

All this is clear. Question - what starting position should be specified in CopyBuffer() to get "without + shift" in your terms?

 
Vladimir Karputov:

You see that you are not being understood. In such a case, it is usual to draw a picture. It is not yet clear what you want to get.


Added: The drawing should show WHAT the result should be.

There was already a drawing. I will repeat it.

You want Buffer[0] to have the MA value corresponding to the red vertical line.
Buffer[1] must have the MA value to the left of the red line. And so on.

And it is all in the indicator.


Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Типы объектов
  • www.mql5.com
При создании графического объекта функцией ObjectCreate() необходимо указать тип создаваемого объекта, который может принимать одно из значений перечисления ENUM_OBJECT. Дальнейшие уточнения свойств созданного объекта возможно с помощью функций по работе с графическими объектами.
 
RickD:

This is all understandable. Question - what starting position to specify in CopyBuffer to get in your terms "without + shift" ?

The value you add for the MA offset is 1.

Reason: