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

Re: [amibroker] Re: Question about LinearReg



PureBytes Links

Trading Reference Links

Hi,
 
I have found it best to run an initial exploration each week after updating my database for new issues, name changes, etc. I run this exploration against all stocks, and it simply returns the stocks that I would condider trading based on price and volume. In my case it returns around 1300 stocks. Then I save these results into a watchlist and all my other work is run against this watchlist.
 
Steve
----- Original Message -----
From: Tony Lei
Sent: Tuesday, July 12, 2005 9:41 PM
Subject: Re: [amibroker] Re: Question about LinearReg

Hi all,

This is what i have so far.  When I have these two filters together, AB takes a long time to scan through entire database.  So i had to separate them into two different scans.  I first filter the stocks based on my criteria and then apply my own linreg scan.  Is there a more efficient way to do this in one simple code? Like filtering and then copy results into watchlist (list 0) and overwriting every time I run it.

thank you for your time

tony
qitrader

//*Filtering
Filter = Close > 10 AND V >= 500000 AND EMA (V, 30) >= 300000 AND ATR (15) >= 1.2;
ATR15 = ATR (15);
EMA30 = EMA (V, 30);AddColumn (C, "Close");
AddColumn (V, "Volume");
AddColumn (ATR15, "Average True Range");
AddColumn (EMA30, "30 Day Average Volume");
//*
//*LinReg Scan

LinRegVal = LinearReg ( Close, 3 ) ;
LinRegChanVal=LinearReg (Close, 23);
LinRegChanSlope = LinRegSlope (Close, 23);

SDev=StDev (Close,23);
LowerLinRegChanVal=LinRegChanVal-.85*SDev;
UpperLinRegChanVal=LinRegChanVal+.85*SDev;

Cond1 = LinearReg(Close,3) > Ref(LinearReg(Close,3),-1) AND LinRegSlope(Close,23) >= 0 AND Close < LowerLinRegChanVal;

Cond2 = LinearReg(Close,3) < Ref(LinearReg(Close,3),-1) AND LinRegSlope(Close,23) <= 0 AND Close > UpperLinRegChanVal;

Filter = Cond1 OR Cond2;

Buy = Cond1;
Short = Cond2;

ATR15 = ATR (15);
EMA30 = EMA (V, 30);
AddColumn (C, "Close");
AddColumn( Buy, "Buy", 1, colorDefault, IIf( Cond1 == 1, colorGreen, Null ) );
AddColumn( Short, "Short", 1, colorDefault, IIf( Cond2 == 1, colorRed, Null ) );
AddColumn (V, "Volume");
AddColumn (ATR15, "Average True Range");
AddColumn (EMA30, "30 Day Average Volume");
//*


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





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
Investment management software Investment property software Investment software
Investment tracking software Return on investment software Stock investment software


YAHOO! GROUPS LINKS