PureBytes Links
Trading Reference Links
|
Dimitris,
It is correct, but when source array is not valid
since the beginning you would need to initialize a
the items for which there are no data to empty value (-1e10)
as shown in the formula below:
EnableScript("jscript");
x = MA(C,15);
f0 = 0.2;
f1 = 1.2;
f2 = -0.4;
<%
x = VBArray( AFL( "x" ) ).toArray();
f0 = AFL( "f0" );
f1 = AFL( "f1" );
f2 = AFL( "f2" );
y = new Array();
for( i = 0; i < 15; i++ ) y[ i ] = -1e10; // init to empty
y[ 15 ] = x[ 15 ];
y[ 16 ] = x[ 16 ]
for( i = 17; i < x.length; i++ )
{
y[ i ] = f0 * x[ i ] + f1 * y[ i - 1 ] + f2 * y[ i - 2 ];
}
AFL.Var("y") = y;
%>
Graph0=MA(C,15);
Graph1 = y;
Best regards,
Tomasz Janeczko
===============
AmiBroker - the comprehensive share manager.
http://www.amibroker.com
----- Original Message -----
From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
To: <amibroker@xxxxxxxxxxxxxxx>
Sent: Sunday, November 04, 2001 1:15 PM
Subject: [amibroker] Re: Newsletter 13/2001 available
> I think it is noe correct, please confirm:
> EnableScript("jscript");
> x = MA(C,15);
> f0 = 0.2;
> f1 = 1.2;
> f2 = -0.4;
> <%
> x = VBArray( AFL( "x" ) ).toArray();
> f0 = AFL( "f0" );
> f1 = AFL( "f1" );
> f2 = AFL( "f2" );
> y = new Array();
> y[ 15 ] = x[ 15 ];
> y[ 16 ] = x[ 16 ]
> for( i = 17; i < x.length; i++ )
> {
> y[ i ] = f0 * x[ i ] + f1 * y[ i - 1 ] + f2 * y[ i - 2 ];
> }
> AFL.Var("y") = y;
> %>
> Graph0=MA(C,15);
> Graph1 = y;
> --- In amibroker@xxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> wrote:
> > Dear Tomasz,
> > "Note also, that with this approach we may pass additional
> arguments
> > so our IIR2 filter may be re-used with various smoothing
> parameters."
> > I attempted to replace (h+l)/2 with other functions (ma, stochd etc)
> > without result.
> > Is there anything I am missing ?
> > Best Regards
> > Dimitris Tsokakis
> > --- In amibroker@xxxx, "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx> wrote:
> > > Dear Tomasz,
> > > Thank you very much for valuable reference.
> > > Best Regards
> > > Dimitris Tsokakis
> > > --- In amibroker@xxxx, "Tomasz Janeczko" <amibroker@xxxx> wrote:
> > > > Hello,
> > > >
> > > > I introduced 2nd order IIR filtering because it is wide known
> > > > filter in acoustics and generally electronics.
> > > >
> > > > The 2nd order filter has less lag and better noise suppression.
> > > >
> > > > As EMA is essential 1st order IIR filter it has worse
> > > characteristics
> > > > than 2nd and higher order filters.
> > > >
> > > > The coefficients can be derived using standard methods
> > > > used in acoustics. See the following references:
> > > > http://www.mesasoftware.com/pub/SMOOTHINGFILTERS.EXE
> > > > SMOOTHING FILTERS . . . . . . . . .Synopsis
> > > >
> > > > Use of smoothing filters is a tradeoff between degree of
> > smoothing
> > > and acceptable lag. This paper discusses the difference between
> > > > FIR (Finite Impulse Response) and IIR (Infinite Impulse
> Response)
> > > filters. Equations for higher order filters is provided, as well
> > > > as a definitive discussion of lag calculation.
> > > >
> > > > also:
> > > > http://monkey.icu.ac.kr/sslab/rr/HICSS2000/DATA/DTISA04.PDF
> > > >
> > > > and acoustic related ones:
> > > >
> > > > http://svr-www.eng.cam.ac.uk/~ajr/SA95/node13.html
> > > >
> > >
> >
> http://www.mathworks.com/access/helpdesk/help/techdoc/ref/filter.shtml
> > > > http://www.onu.edu/user/FS/lthede/adfd_txt.htm
> > > > http://www.gresilog.com/english/excommen/doc/fil_rec.htm
> > > >
> > > >
> > > > Best regards,
> > > > Tomasz Janeczko
> > > > ===============
> > > > AmiBroker - the comprehensive share manager.
> > > > http://www.amibroker.com
> > > >
> > > > ----- Original Message -----
> > > > From: "DIMITRIS TSOKAKIS" <TSOKAKIS@xxxx>
> > > > To: <amibroker@xxxx>
> > > > Sent: Saturday, November 03, 2001 5:15 PM
> > > > Subject: [amibroker] Re: Newsletter 13/2001 available
> > > >
> > > >
> > > > > Dear Tomasz,
> > > > > Thank you for interesting techniques of Issue 13/2001.
> > > > > Two preliminary questions, not on the technique but on
> > > > > the subject itself:
> > > > > A. In
> > > > > f0 = 0.2;
> > > > > f1 = 1.2;
> > > > > f2 = -0.4;
> > > > > do you follow some formula or relation between f s ?
> > > > > I noticed that slight changes form -0.4 to -0.5 have quite
> > > > > different response.
> > > > > B. In what sense do you find this ema "better".?
> > > > > I did not see that.
> > > > > If the example was just to show the technique, it is O. K.
> > > > > Best Regards
> > > > > Dimitris Tsokakis
> > > > > --- In amibroker@xxxx, "Tomasz Janeczko" <amibroker@xxxx>
> wrote:
> > > > > > Hello,
> > > > > >
> > > > > > The newsletter issue 13/2001 is available at:
> > > > > > http://www.amibroker.com/newsletter/13-2001.html
> > > > > >
> > > > > > Enjoy.
> > > > > >
> > > > > > Best regards,
> > > > > > Tomasz Janeczko
> > > > > > ===============
> > > > > > AmiBroker - the comprehensive share manager.
> > > > > > http://www.amibroker.com
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > Your use of Yahoo! Groups is subject to
> > > http://docs.yahoo.com/info/terms/
> > > > >
> > > > >
> > > > >
>
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
|