Индикаторы: Batterwort Moving Average - страница 3

 
YUBA:

В том или ином виде есть в любой книге по цифровым фильтрам - все стандартные виды фильтров давно расписаны, ничего нового здесь придумывать не надо.

Жаль только, что в программы ТА вместо этих давно известных фильров встроены SMA,EMA и прочее, не выдерживающее никакой критики.

 

"You wan't believe - it's not Batter..."

Гассиан и Баттерворс:

Gaussian and Other Low Lag Filters

John Ehlers

For an equivalent number of poles, the lag of a Gaussian filter is about half the lag of a Butterworth filter. More importantly, the higher frequency components have still less lag than the low frequency components. With Gaussian filters the lag as a function of frequency is going in the right direction for traders. It is also true that a Gaussian filter has about half the smoothing effectiveness as an equivalently sized Butterworth filters. Said another way, a 4 pole Gaussian filter has about the same smoothing performance as a 2 pole Butterworth filter. Thus, to do the same filtering job, these two filters would have about the same low frequency lag but the Gaussian filter would preserve the original price function with greater fidelity because the higher frequency components within the passband would not be delayed as much as in the Butterworth filter. Comparative filter responses of a 2 pole Butterworth filter and a 2 pole Gaussian filter, each having a 10 bar cycle passband, is shown in Figure 3.

Figure 3. Comparison of 2 Pole Filters shows the Gaussian filter (Cyan)has much less lag than the Butterworth filter (Red). The Gaussian filter has less smoothing.

NUTS AND BOLTS

There is no magic to a Gaussian filter. It is just the multiple application of an Exponential Moving Average. From my previous article the transfer response of an exponential moving average is
H(z) = a / (1 – (1-a) Z-1)
So that applying the exponential moving average “N” times gives a N Pole filter response as
H(z) = aN / (1 – (1-a) Z-1)N
At zero frequency Z-1=1, so this low pass filter has unity gain. Also, the denominator assumes the value of aN at zero frequency. The corner frequency of the filter is defined as that point where the transfer response is down by 3 dB, or .707 in amplitude. When this occurs, we have the relationship
(1 – (1-a) Z-1)N = 1.414aN where Z-1 = e-jw and w = 2p/P
Crunching through the complex arithmetic, we arrive at the solution for alpha as
a = -b + SQR(b2 + 2b)
Where b = (1 – cos(w)) / (1.4142/N – 1)

This generalized solution for alpha can be used to compute the coefficients for any order Gaussian filter. Recalling that the filtered output is determined by the equation
f(z) = H(z)g(z) where g(z) is the input price

If H(z) is of the form 1/(1 – (1-a) Z-1)N we can easily form equations for the output in EasyLanguage metaphor because Z-1 is synonymous with a one bar lag. These equations are:
One Pole: f = ag + (1-a)f[1]
Two Poles: f = a2g + 2(1-a)f[1] - (1-a)2f[2]
Three Poles: f = a3g + 3(1-a)f[1] - 3(1-a)2f[2] + (1-a)3f[3]
Four Poles: f = a4g + 4(1-a)f[1] - 6(1-a)2f[2] + 4(1-a)3f[3] - (1-a)4f[4]
Etc.

-------------------

Cybernetics cycles for stocks and futures, page 182:

more: All 25 indicators from the book "Cybernetics Analysis for Stock and Futures"

http://mqlsoft.com/download/indicators

 

Почему не поверю. Все дело только в методе перехода s -> z. По ряду причин Баттерворт мне нравится больше, тем более прототип был баттервортовский.

3-й порядок сделал так, чтобы считать меньше - (1-z^-1)^3. - соответствует последовательному соединению (и одному из фильтров в статье). Однако в этом виде не прокатило - нехорошо все полюсы сводить в одну точку. Пришлось считать как положено.

Вообще-то, этот вариант сейчас уже не использую.

 

правильно, пацаны шо в математике догоняют сказали, что буржуи пусть у себя там сами разбираются шо намесили - нарубали сплеча всех Бутербродов с Гусями - Джо там сам все не правильно понял где у него Гошинский где чей - пусть разберется и сам переставит где Батерврот где полбу (намутил там у себя)

нам не важно - Даешь третий полюс! Y. - где у тебя третий?

Гуся - На Масло!

...

 
fxxx:

- Даешь третий полюс! Y. - где у тебя третий?

...

:)) Возьми у Джона... . У него все ходы записаны.

 
YUBA:
fxxx:

- Даешь третий полюс! Y. - где у тебя третий?

...

:)) Возьми у Джона... . У него все ходы записаны.

- я тоже не злопамятный (поэтому все записую)

в мт4 этого еще, кажется, небыло - Ты самое главное сделал, двухполярный, - так сделай третий, чтоб уже в твой никто не лез и там не ковырялся

а как обозвать Гусем или Battом - это уже такое дело (главное чтоб было что...)

 
Topor:

One Pole: f = ag + (1-a)f[1]

Two Poles: f = a2g + 2(1-a)f[1] - (1-a)2f[2]

Three Poles: f = a3g + 3(1-a)f[1] - 3(1-a)2f[2] + (1-a)3f[3]

Four Poles: f = a4g + 4(1-a)f[1] - 6(1-a)2f[2] + 4(1-a)3f[3] - (1-a)4f[4]

Etc.

Формулы взяты из работы "John Ehlers. GAUSSIAN and Other Low Lag Filters".

Спасибо, YUBA - трехполярный тоже выглядит неплохо (рис. БатМА 2\3 пол. и 2\3 Батерворт),15

Three Poles: f = a3g + 3(1-a)f[1] - 3(1-a)2f[2] + (1-a)3f[3] - соответствует вашему фильтру, третьему полюсу.

BatMA, 3d pole: p1=Kf*Kf*Kf; p2=3.0*(1-Kf); p3=3.0*(1-Kf)*(1-Kf); p4=(1-Kf)*(1-Kf)*(1-Kf);

ExtMapBuffer[pos]=p1*ExtMapBuffer0[pos]+p2*ExtMapBuffer[pos+1]-p3*ExtMapBuffer[pos+2]+p4*ExtMapBuffer[pos+3];

 
fxxx:


BatMA, 3d pole: p1=Kf*Kf*Kf; p2=3.0*(1-Kf); p3=3.0*(1-Kf)*(1-Kf); p4=(1-Kf)*(1-Kf)*(1-Kf);

ExtMapBuffer[pos]=p1*ExtMapBuffer0[pos]+p2*ExtMapBuffer[pos+1]-p3*ExtMapBuffer[pos+2]+p4*ExtMapBuffer[pos+3];

Неужели и это не забыли? :)

case 3 : pr=MathPow(2.0/(1.0+MA_Period),1.0/3); Bat3Ma(pr); break; 
 

можт и забыли : (( ...

Причина обращения: