Here is an similar indicator right from the Amibroker website, so you 
can see the proper snytax:

Price = (H+L)/2;
MomLength = 15;

PriceMomSum = 0;
FiveMomSum = 0;

FiveMom = abs(Price - Ref(Price, -5));
PriceMom = Price * FiveMom;
for (i=0; i < MomLength; i++) {
        PriceMomSum = PriceMomSum + Ref(PriceMom, -i);
        FiveMomSum = FiveMomSum + Ref(FiveMom, -i);
}
NLEF = PriceMomSum / FiveMomSum;

Plot(Close, "Close", colorBlack, styleLine);
Plot(NLEF, "NonLinear Ehlers Filter", IIf(Close>NLEF, colorGreen, 
colorRed), styleLine);


--- In [email protected], "gmorlosky" <[EMAIL PROTECTED]> wrote:
>
> AFL is easier. Use the Formula Editor icon to check your code. The 
> guide has many excellent exmaples. Try this thinking:
> 
> Price = ((H+L)/2);
> alpha1 = (0.25);
> alpha2 = (0.35);
> Lead = (0);
> NetLead= (0),
> EMA= (0); - EMA is a defined term - don't use it - use EMA1 or 
> something
> 
> Plot(EMA1, "EMA1", colorRed, styleLine, Null, Null, 10 ); 
> 
> 
> --- In [email protected], "goldandwood" <goldandwood@> 
> wrote:
> >
> > Hello everyone! Below is the tradestation code of Leading 
indicator 
> > from John Ehlers. I've tried translating it into AFL code several 
> > times but failed as my programming knowledge is very limited! I 
> post 
> > it here so let someone who is good at AFL to do the job and make 
it 
> > shares with all....thank you very much!!
> > 
> > 
> > Inputs :Price((H+L)/2),
> >         alpha1(0.25),
> >         alpha2(0.35);
> > Vars :  Lead(0),
> >         NetLead(0),
> >         EMA(0);
> > Lead = 2*Price + (alpha1 - 2)*Price[1] + (1 - alpha1)*Lead[1];
> > NetLead = alpha2*Lead + (1 - alpha2)*NetLead[1];
> > EMA = 0.5*Price + 0.5*EMA[1];
> > Plot1(NetLead,"Lead");
> > Plot2(EMA,"EMA");
> > 
> > 
> > And thanks again!
> >
>


Reply via email to