Yes true, so factor is 1.
Before, i put the corretive factor in the loop because, it need to be 
corrected inside the loop to keep array "it" and array "array" same scale. 
But now it doesn't need at all factor héhé ! thx.

I make comparaison with new formula, and it is now like very near a DEMA and 
not at all like a T3... oups ; )
Is it DEMA because there is two recursion on "it" array : it(i-1) and 
it(i-2) ?
So this MA can be seens as two filter one FIR (act on the previous value of 
"array" and one IIR (act on the previous valus of the resulting MA "it").
The IIR is a DEMA. Diff. comes from the FIR part, am i right ?

Ehler constructed this MA this way :
- start from classic EMA
- add a FIR part so impulse reponse is finite, so high frequency can be 
attenuated to 0
- take inverse of this LP filter ( 1-LP ) to obtain HP Filter
- make HP Filter second order HP Filter by squaring its impulse response 
(signal pass two times in the same HP Filter)
- make a final LP Filter from the HP Filter 2nd order ( LP_Final = 1 - 
HP_Filter_secondorder)

So as this MA substract the high frequency (noise or Elher speak about 
cycles for those high freq.) of the original signal, and the low frequency 
are keep intact without any lag.
That is why he says Zero Lag for low frequency (so long periods) .... so 
"Instatentaneaous Trendline".
Keep only the trend without any lag by substacting cycle components.
Héhé magic ehler !
But on charts seems like a classic DEMA... !? or TEMA.
Not same than EMA because EMA keep a continious component which make it 
biased. You can clearly see this bias on the chart by plotting IT/DEMA/TEMA 
againt EMA.
T3 filter a lot better noise, and can keep good amplitude by the slope 
factor... problem is it lag a lot more than IT/DEMA/TEMA for high periods.

Maybe IT can be use as a good detrender. I will try to use it for AR 
prediction against the T3 i was using.

For now we spoke about :
- Instantaneous Trendline
- DEMA/TEMA
- EMA
- T3
- Laguerre/Kautz Filter (i posted code to the library for the adaptive 
version : http://www.amibroker.com/library/detail.php?id=772 )

Any new ones or advice about nice MA to used for finding trend (LPF) or 
cyclic (HPF) of a signal ?

Cheers,
Mich.




----- Original Message -----
From: Paul Ho
To: [email protected]
Sent: Friday, December 01, 2006 7:01 AM
Subject: RE: [amibroker-ts] Re: Moving Average... one more again : )


By the way shouldn’t factor be

factor = (alpha - alpha^2/4) + .5*alpha^2 - (alpha - .75*alpha^2) +
2*(1 - alpha) - (1 - alpha)^2;

which is 1 anyway???

_____

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul Ho
Sent: Friday, 1 December 2006 11:17 AM
To: [email protected]
Subject: RE: [amibroker-ts] Re: Moving Average... one more again : )

I am not sure if the correction is right, may be its better to use

IT = IT /factor; after the loop.

_____

From: amibroker-ts@ ts%40yahoogroups.com> yahoogroups.com
[mailto:amibroker-ts@ ts%40yahoogroups.com>
yahoogroups.com] On
Behalf Of Tom Tom
Sent: Friday, 1 December 2006 7:27 AM
To: amibroker-ts@ ts%40yahoogroups.com> yahoogroups.com
Subject: Re: [amibroker-ts] Re: Moving Average... one more again : )

Hi!

I try the moving average. Thx !
Need some correction in the code to be exact scale (see end of message).
I compared it to several MA. Different than Dema i found (ITrend seems to
filter more).
I find it to be nearer from T3.
Try following settings :
ITrend : 0.11
T3: Periods 6 and Slope 0.9
Near the same...

ITrend is a Recursive FIR filter. (FIR part and FII part, numerator and
denominator of impulse response).
So if you say it is like Ingenious MA, maybe Ingenious MA is like T3... and
any MA is the same as soon as you get good settings to match seems.
That is what i think. All we do with all those linear MA is to change
settings to move cut off frequencies and resonance or order of the filter.

I find the best MA are those which are non-linear and take in account some
another information to adapt their filtering (erreur from Yfiltered and
Yoriginal, volume impact, ...).
I try Laguerre Filter and even try to implement Kautz Filter (generic
Laguerre filter... can have some impact one the phase because it treats
complex signal). Kautz was to hard to code.... :).
Laguerre filter, make differents frequency have not the same lag (lag
depends of the frequency).
More explaination on mesa elher website (there is code to compute it too,
even an adaptive version) or look google for Laguerre or Kautz filter.

Code for ITrend to be at good scale :
//----------------------------------------------------------
SetBarsRequired(20000,20000);

function ITrend(array, alpha) {
// Choose One Of the initialization :

// No pre-filter :
it = array;

// Pre-initialize its first value and after it converge to "array" value
during main recursion (so act like no pre-filter after some times)
//it = (array[2] - 2*array[1] + array[0])/4; //This initialization takes a
long time to converge.

// Pre-filter with classic triangular MA
//it = (array + Ref(array, -1) * 2 + Ref(array, -2))/4;

factor = (alpha - alpha^2/4) + 5*alpha^2 - (alpha - .75*alpha^2) + 2*(1 -
alpha) - (1 - alpha)^2;

for(i = 4; i < BarCount; i++) {
it[i] = (alpha - alpha^2/4)*array[i] +
5*alpha^2*array[i-1] -
(alpha - .75*alpha^2)*array[i-2] +
2*(1 - alpha)*it[i-1] -
(1 - alpha)^2*it[i-2];

it[i] = it[i]/factor;
}

return it;
}

P = ParamField("Price field",-1);
alpha = Param( "Alpha", 0.3, 0, 1, 0.01 );

data = ITrend(P, alpha);
Plot( data, "ITrend", ParamColor( "Color ITrend", colorCycle ),
ParamStyle("Style") );
//----------------------------------------------------------

Cheers,
Mich

----- Original Message -----
From: Fred
To: amibroker-ts@ ts%40yahoogroups.com> yahoogroups.com
Sent: Thursday, November 30, 2006 6:07 PM
Subject: [amibroker-ts] Re: Moving Average... one more again : )

Isn't this equivalent or roughly equivalent to a DEMA ...

--- In amibroker-ts@ ts%40yahoogroups.com>
yahoogroups.com, "Paul Ho" .> wrote:
>
>I use this one, looks close enough to what he is talking about.
It is some
>kind of FIR……but it doesn't provide code.
>
>function ITrend(array, alpha)
>
>{
>
>// initialize early array values and declare as array
>
>it = array; //(array + Ref(array, -1) * 2 + Ref(array, -2))/4;
>
>//it = (array[2] - 2*array[1] + array[0])/4; This initialization
takes a
>long time to converge.
>
>for(i = 2; i < BarCount; i++)
>
>{
>
>it[i] = (alpha - alpha^2/4)*array[i] +
>
>.5*alpha^2*array[i-1] -
>
>(alpha - .75*alpha^2)*array[i-2] +
>
>2*(1 - alpha)*it[i-1] -
>
>(1 - alpha)^2*it[i-2];
>
>}
>
>return it;
>
>}
>
>Its from Elhers' book. Alpha = 2/(period + 1); It has zero lag, I
found
>centering to be real bad for forecast as the averages finishes x
bars ago
>and AB copies the last known bar across these x bars, causing AR
prediction
>to flat line initially.
>
>
>
>_____
>
>From: amibroker-ts@ ts%40yahoogroups.com> yahoogroups.com
[mailto:amibroker-
[EMAIL PROTECTED] roups.com> com] On
>Behalf Of Tom Tom
>Sent: Thursday, 30 November 2006 10:05 AM
>To: amibroker-ts@ ts%40yahoogroups.com> yahoogroups.com
>Subject: [amibroker-ts] Moving Average... one more again : )
>
>
>
>Hello,
>
>I was just surfing and find this :
>http://www.tradecis
>
<http://www.tradecis
<http://www.tradecis
<http://www.tradecision.com/product/special_techniques/ingeniousma.ht>
ion.com/product/special_techniques/ingeniousma.ht>
ion.com/product/special_techniques/ingeniousma.ht
m>
>ion.com/product/special_techniques/ingeniousma.htm
>
>Always competition between T3, Jurik, etc... and this one say it
is the
>better one (what a good advertisment! héhé).
>
>Does someone try it ? On what does it rely (noise filter
adaptative based on
>
>statistics, use prediction so it can be a little shiffted
backward, use
>volume or volatility information or any other technics to filter
noise, use
>fitting method...etc ??).
>It is consistent in time ?... . i mean, when a new data arrive it
didn't
>change old MA values (not like Fit or Predict. methods wich are
not
>consistent because some past values are computed from less old
past value).
>
>Thanks.
>Cheers,
>Mich.
>
>__________________________________________________________
>Live.com: le nouveau moteur de recherche par Messenger! http://www.windowsl

><http://www.windowsl <http://www.windowsl
<http://www.windowslive.fr/livecom/> ive.fr/livecom/> ive.fr/livecom/>
ive.fr/livecom/
>
>
>
>
>
>[Non-text portions of this message have been removed]
>

__________________________________________________________
Live.com: le nouveau moteur de recherche par Messenger!
http://www.windowsl <http://www.windowsl
<http://www.windowslive.fr/livecom/> ive.fr/livecom/> ive.fr/livecom/

[Non-text portions of this message have been removed]

[Non-text portions of this message have been removed]




_________________________________________________________________
Windows Live Messenger sur i-mode™ : dialoguez avec vos amis depuis votre 
mobile comme sur PC ! http://mobile.live.fr/messenger/bouygues/

Reply via email to