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

[amibroker] Re: Need help with Explore code



PureBytes Links

Trading Reference Links


To All:

I figured it out. Here's the code for those who are interested:

stema=EMA(Close,7);
ltema=EMA(Close,35);
Days=30;
Var=LastValue(Sum(stema>ltema,Days));
Filter=Var==Days;
AddColumn(Close,"Close",1);

This code scans and lists those stocks whos short term moving average 
is greater than its longer term moving average for at least the last 
30 days.

Thanks to all who gave input and got me going in the right direction.

Alan


--- In amibroker@xxxxxxxxxxxxxxx, "alannortham" <anortham@xxxx> wrote:
> 
> --- In amibroker@xxxxxxxxxxxxxxx, "Bill Barnard" <wbarnard@xxxx> 
> wrote:
> > 
> > --- In amibroker@xxxxxxxxxxxxxxx, "alannortham" <anortham@xxxx> 
> wrote:
> > > 
> > > I tried the following code which is suppose to filter my stocks
> > when 
> > > the short term ema is above the longer term ema for the last 30 
> > > days.  However when I run it, it gives an error message saying I
> > need 
> > > to define a NumColumn variable.  I know how to add a new column 
> but
> > I 
> > > am not sure what the array needs to be.  Can anyone help me get
> > this 
> > > code working?
> > > 
> > > <==Start Code==>
> > > st=ema(c,10);
> > > >lt=ema(c,20);
> > > >filter=sum(st>lt,30)==30;
> > > <==End Code==>
> > > 
> > > Thanks,
> > > Alan
> > 
> > 
> > 
> > Hi Alan,
> > 
> > Try this:
> > 
> > st=EMA(C,10);
> > lt=EMA(C,20);
> > Filter=Sum(st>lt,30)==30;
> > AddColumn(C, "Close");
> > 
> > 
> > Bill
> 
> Thanks Bill for the response and for the code improvement.  Adding 
> the AddColumn gets rid of the error message however, when I run the 
> scan it lists stock tickers who's short term ema is above the 
longer 
> term ema as well as stock tickers who's long term ema is above the 
> short term ema.  There still needs to be some code improvement so 
> that only the stock tickers are listed who's short term ema is 
> currently above the long term ema and has been for at least the 
last 
> 30 day's.  Any ideas?
> 
> Alan





------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/