[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[amibroker] Re: HELP for the AFL code of Leading indicators(by John Ehlers)



PureBytes Links

Trading Reference Links

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 amibroker@xxxxxxxxxxxxxxx, "gmorlosky" <gmorlosky@xxx> 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 amibroker@xxxxxxxxxxxxxxx, "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!
> >
>



------------------------------------

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 NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/

For other support material please check also:
http://www.amibroker.com/support.html
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/