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

IT = IT /factor; after the loop.

 

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of Tom Tom
Sent: Friday, 1 December 2006 7:27 AM
To: [email protected]
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@ <mailto:amibroker-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@ <mailto:amibroker-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@ <mailto:amibroker-ts%40yahoogroups.com> yahoogroups.com
[mailto:amibroker-
[EMAIL PROTECTED] <mailto:ts%40yahoogroups.com> com] On
>Behalf Of Tom Tom
>Sent: Thursday, 30 November 2006 10:05 AM
>To: amibroker-ts@ <mailto:amibroker-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.tradecision.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.windowslive.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.windowslive.fr/livecom/> ive.fr/livecom/

 



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

Reply via email to