А чего для экпоненциальной? Она и так изначально с "дробным" периодом, которого у нее, собственно, и нет - там только коэфф. обратной связи. Это в МТ так сделали, что EMA не дробная. А так она всегда имела дробный параметр. Пересчитывайте из дробного периода этот коэфф-т и все дела. k=2.0/(1+period); Ну, а остальные из стандартных - элементарно уже делаются.
Please forgive me generously for being illiterate.
It's just the way Alexei set the task. ;)
And we've already picked up the answer - like, similar to the previous averages...
Well, here's an added switch EMA with a fractional period. Whoever wants it, can continue. Two methods left.))) And then you can do a full replacement of the built-in iMA with price type, shift, etc.
#property indicator_chart_window // в окне инструмента#property indicator_buffers 1#property indicator_color1 Blue // входные параметрыexterndouble MAperiod=3; // externint Method=0;
int History=0; // 0- все барыdouble MA[]; // массив буфераdouble k; // коэфф. EMAdouble rt; // дробная часть периодаint per; // целая часть периодаvoid init() { // инициализация
per=MathFloor(MAperiod);
rt=MAperiod-per;
k=2.0/(1+MAperiod);
SetIndexBuffer(0,MA); // индикатор
SetIndexLabel(0,"MA("+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--) { // цикл пересчета по ВСЕМ барамswitch(Method) {
case0: // SMAint j=i+per;
double ma=rt*Close[j];
j--;
for(; j>=i; j--) ma+=Close[j];
ma/=MAperiod;
MA[i]=ma;
break;
case1: // EMA
MA[i]=k*Close[i]+(1-k)*MA[i+1];
}
}
}
Вопрос с ЕМА был провокационным, и я его спецом поставил в конец списка :)
Well, it wasn't me you provoked, after all.)) Yeah, tried my indicator with the fractional weight in the high bar? Seems logical to me. Especially if you think of it as a series, and how the period fractional crawls on the oldest member.))
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.
А чего для экпоненциальной? Она и так изначально с "дробным" периодом, которого у нее, собственно, и нет - там только коэфф. обратной связи. Это в МТ так сделали, что EMA не дробная. А так она всегда имела дробный параметр. Пересчитывайте из дробного периода этот коэфф-т и все дела. k=2.0/(1+period);
Ну, а остальные из стандартных - элементарно уже делаются.
Please forgive me generously for being illiterate.
It's just the way Alexei set the task. ;)
And we've already picked up the answer - like, similar to the previous averages...
Просто Алексей так задачу поставил. ;)
The EMA question was provocative and I deliberately put it at the end of the list :)
And only elementary.
Вопрос с ЕМА был провокационным, и я его спецом поставил в конец списка :)
Well, it wasn't me you provoked, after all.))
Yeah, tried my indicator with the fractional weight in the high bar? Seems logical to me. Especially if you think of it as a series, and how the period fractional crawls on the oldest member.))