PureBytes Links
Trading Reference Links
|
Hi Steve,
I know and would like to thank you for this. I only wanted to
show Jeff that his problem could
be solved without PREV at all.
BTW: I noticed that many authors just *love* PREV whileit is
infernal because it is so slow.
In 95% cases one could write simpler and much faster formula
without PREV.
Best regards,
Tomasz Janeczko
<BLOCKQUOTE
>
----- Original Message -----
<DIV
>From:
Steve Wiser
To: <A title=amibroker@xxxxxxxxxxxxx
href="">amibroker@xxxxxxxxxxxxxxx
Sent: Wednesday, June 20, 2001 11:26
AM
Subject: Re: [amibroker] Previous
Value
Tomasz:My point in sharing that code was not to
provide a AMA but to show how to do the 'previous' thing in
VBScript. I wanted an easy example that would not clutter up the essential
part I wanted to show and the moving average was it.Just a
note.SteveAt 08:46 AM 6/20/01 +0200, you wrote:>HiJeff
and Steve,>>Yes, you can do it in VBSctipt and JScrtipt but
there is also much easier >and faster way>of calculating any
kind of variable-weight (adaptive) moving average using>AMA function
:>>AMA - adaptive moving average (AFL 1.5)>SYNTAX ama(
ARRAY, SMOOTHINGFACTOR )>RETURNS ARRAY>FUNCTION calculates
adaptive moving average - simliar to EMA() but >smoothing factor could
be time-variant (array).>EXAMPLE>>The example of
volatility-weighted adaptive moving average formula:>>graph0 =
ema( close, 15 );>fast = 2/(2+1);>slow =
2/(30+1);>dir=abs(close-ref(close,-10));>vol=sum(abs(close-ref(close,-1)),10);>ER=dir/vol;>sc
=( ER*(fast-slow)+slow)^2;>>graph0 = ama( close, sc
);>>AMA works like this (pseudo-code):>// for day "i" the
value is:>movavg[ i ] = smoothingfactor * array[ i ] + ( 1 -
smoothingfactor ) * >movavg[ i - 1 ];>// movavg[ i - 1 ] isa
PREVIOUS day value of movavg>>There is also a second version of
AMA called AMA2 when you get 3 parameters:>AMA2( Array, ForwardFactor,
FeedbackFactor ) and is equivalent to this >pseudo-code>// for
day "i" the value is:>movavg[ i ] = forwardfactor * array[ i ] +
feedback * movavg[ i - 1 ];>// movavg[ i - 1 ] is a PREVIOUS day value
of movavg>>Best regards,>Tomasz
Janeczko>>----- Original Message ----->From:
<mailto:slwiserr@xxxx>Steve Wiser>To:
<mailto:amibroker@xxxxxxxxxxxxxxx>amibroker@xxxxxxxxxxxxxxx>Sent:
Wednesday, June 20, 2001 12:36 AM>Subject: Re: [amibroker] Previous
Value>>Jeff:>>This has been done using VBScript a
couple of times once as an example and>another as a tool for an
indicator.>See the attached file as an
example.>>SteveYour
use of Yahoo! Groups is subject to the <A
href="">Yahoo! Terms of Service.
|