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
----- Original Message -----
Sent: Friday, October 07, 2005 5:57
PM
Subject: [amibroker] Tradestation
language ??
Any ex Tradestaion users here that can help me
out?
Have some code that is *supposed* to
replicate VantagePoint MA projection. I can figure it all OK, except
for
this -
ProjMA[1]
What is the
equivalent in AFL?
Input: DampFactor(.3), MALength(5)
; Vars: ProjMA(0), Mid(0), MA(0) ;
Mid = (High + Low)/2 ; ProjMA
= Mid - (DampFactor * (Mid - ProjMA[1])) ; MA = Average(close, MALength)
;
Plot1 (ProjMA, "ProjMA" ,cyan, default, 1 ) ; Plot2 (MA, "Avg",
yellow, default, 1 ) ;
///VP MA
DampFactor = 0.3;
MALength = 5 ;
ProjMA = 0;
Mid = 0;
MAs = 0 ;
Mid = (High + Low)/2
;
ProjMA = Mid - (DampFactor * (Mid - ProjMA[1])) ; // <<????
MAs = MA(Close, MALength)
;
Plot (ProjMA, "ProjMA" ,colorDefault ) ;
Plot (MAs, "Avg", colorYellow ) ;
Please note that this group is for discussion between users only.
To get support from AmiBroker please send an e-mail directly to
SUPPORT {at} amibroker.com
For other support material please check also:
http://www.amibroker.com/support.html
SPONSORED LINKS
YAHOO! GROUPS LINKS
|