----- Original Message -----
Sent: Saturday, October 08, 2005 2:09
AM
Subject: Re: [amibroker] Tradestation
language ??
Hello,
ProjMA[1] is previous value and code
does simply exponential
smoothing.
This
ProjMA = Mid - (DampFactor * (Mid - ProjMA[1])) ;
can be rewritten to:
ProjMA = Mid - DampFactor * Mid + DampFactor *
ProjMA[ 1 ];
and then to:
ProjMA = Mid * ( 1 - DampFactor ) + DampFactor *
ProjMA[ 1 ];
AFL equivalent of such statement is:
ProjMA = AMA( Mid, 1 - DampFactor );
Entire code:
DampFactor = 0.3;
MALength = 5 ;
ProjMA = 0;
Mid = 0;
MAs = 0 ;
Mid = (High + Low)/2 ;
ProjMA = AMA( Mid, 1 -
DampFactor );
MAs = MA(Close, MALength) ;
Plot (ProjMA, "ProjMA" ,colorDefault ) ;
Plot (MAs, "Avg", colorYellow ) ;
Best regards,
Tomasz
Janeczko
amibroker.com