Mathemat>>: grell предложил формулу, показывающую, как можно непрерывно трансформировать мувинг от периода 3 к периоду 4. При этом изменяются мувинги целиком, а не их отдельные коэффициенты: все к-ты варианта grell'a отличаются от предложенных раньше.
>> so kudos to him! >> I wrote.
avatara wrote >> What else can you suggest? A simple interpolation would be in order?
---
Mathemat>>: avatara, don't be stingy, offer your geometric version.
Let's put the question another way. What does a period of 3.333333 mean?
1. Does the calculation use 3 full bars and a third of the fourth bar? Then which bar to take? 2. The calculation uses some kind of "average" between 3 and 4 periods. What is such an average? 3. When calculating, do we take a little from each bar? How much? 4. When calculating we transform the TF. How? etc.
By the way, transforming the TF is also an option. We're getting into a bit of a rut here... I wonder if anyone knows how this is implemented in platforms offering non-integer periods?
So I sketched out an indicator using the SMA. Actually, it makes sense that the weighting of the fractional part is on the higher bar. We are counting back to the history. Here's the picture. Red - SMA(4), blue - SMA(3.5), green - SMA(4.5): The turkey is attached, and here's the code:
#property indicator_chart_window // в окне инструмента#property indicator_buffers 1#property indicator_color1 Blue // входные параметрыexterndouble MAperiod=3; // int History=0; // 0- все барыdouble SMA[]; // массив буфераdouble rt; // дробная часть периодаint per; // целая часть периодаvoid init() {// инициализация
per=MathFloor(MAperiod);
rt=MAperiod-per;
SetIndexBuffer(0,SMA); // индикатор
SetIndexStyle(0,DRAW_LINE);
SetIndexLabel(0,"SMA("+DoubleToStr(MAperiod,2)+")");
}
void start() {
int limit=Bars-IndicatorCounted()-1;
if(History!=0 && limit>History) limit=History-1; // кол-во пересчетов по историиfor(int i=limit; i>=0; i--) { // цикл пересчета по ВСЕМ барамint j=i+per;
double ma=rt*Close[j];
j--;
for(; j>=i; j--) ma+=Close[j];
ma/=MAperiod;
SMA[i]=ma;
}
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
grell предложил формулу, показывающую, как можно непрерывно трансформировать мувинг от периода 3 к периоду 4. При этом изменяются мувинги целиком, а не их отдельные коэффициенты: все к-ты варианта grell'a отличаются от предложенных раньше.
avatara wrote >>
What else can you suggest? A simple interpolation would be in order?
avatara, don't be stingy, offer your geometric version.
Not everyone has spoken yet. ;)
>> Progger ignores it :(
Пока мы тут лясы точим, Unknow там капусту рубит:)))
State even posted.
;)
1. Does the calculation use 3 full bars and a third of the fourth bar? Then which bar to take?
2. The calculation uses some kind of "average" between 3 and 4 periods. What is such an average?
3. When calculating, do we take a little from each bar? How much?
4. When calculating we transform the TF. How?
etc.
I wonder if anyone knows how this is implemented in platforms offering non-integer periods?
Блин, мужики, вам только палец покажи! Пять страниц не предел.
Do you know the solution?
Or not interested?
Here's the picture. Red - SMA(4), blue - SMA(3.5), green - SMA(4.5):
The turkey is attached, and here's the code: