07 January 2012

Stock Scanning /Shortlisting

You can scan based on a variety of parameters.

Period – the last n bars that you want to scan Rate of change for 3 groups of n bars in the period above. If ROC is made 0, no rate of change is compared for that period. The AFL selects both positive ROC combinations and the converse. For example if you choose a ROC combination of 0.2, 0.2 and 0.2 for 10 bars, the selection of minus .2, minus .2, and minus .2 is automatic.

Use exploration to view the results. In exploration you can also sort by Price change during the day or within the range of n bars.

You can choose appropriate time frames and stocks lists using the Settings and Define options in Automatic Analysis.

Go ahead and modify to suit your needs.



n =Param("Period", 6, 1, 50, 1 );
n1 = Param("ROC1", 0.2, -2, 3, 0.01);
n2 = Param("ROC2", 0, -2, 3, 0.01);
n3 = Param("ROC3", 0, -2, 3, 0.01);


//Cond1 = IIf((C-Ref(C,-1))/Ref(C,-1)> 0.01 AND C>EMA(C,10),1,0);
//Cond2 = IIf((Ref(C,-1)-C)/Ref(C,-1)> 0.01 AND C0 AND n2>0 AND n3>0)
{
Cond1= ROC1 > n1 AND ROC2 > n2 AND ROC3 > n3;
Cond2= ROC1 < -n1 AND ROC2 < -n2 AND ROC3 < -n3; } else if(n1>0 AND n2>0 AND n3==0)
{
Cond1= ROC1 > n1 AND ROC2 > n2 ;
Cond2= ROC1 < -n1 AND ROC2 < -n2 ; } else if(n1>0 AND n2==0 AND n3==0)
{
Cond1= ROC1 > n1 ;
Cond2= ROC1 < -n1 ; } else if(n1>0 AND n2==0 AND n3>0)
{
Cond1= ROC1 > n1 AND ROC3 > n3;
Cond2= ROC1 < -n1 AND ROC3 < -n3; } else if(n1==0 AND n2>0 AND n3>0)
{
Cond1= ROC2 > n2 AND ROC3 > n3;
Cond2= ROC2 < -n2 AND ROC3 < -n3; } else if(n1==0 AND n2>0 AND n3==0)
{
Cond1= ROC2 > n2 ;
Cond2= ROC2 < -n2; } else if(n1==0 AND n2==0 AND n3>0)
{
Cond1= ROC3 > n2 ;
Cond2= ROC3 < -n2; } else if(n1==0 AND n2==0 AND n3==0) { Cond1= 1; Cond2= 1; } else if(n1>0 AND n2<0 AND n3==0) { Cond1= ROC1 > n1 AND ROC2 < n2 ; Cond2= ROC1 < -n1 AND ROC2 > -n2 ;
}
else if(n1<0 AND n2>0 AND n3<0) { Cond1= ROC1 < n1 AND ROC2 > n2 AND ROC3 < n3; Cond2= ROC1 > -n1 AND ROC2 < -n2 AND ROC3 > n3;
}
else if(n1<0 AND n2>0 AND n3>0)
{
Cond1= ROC1 < n1 AND ROC2 > n2 AND ROC3 > n3;
Cond2= ROC1 > -n1 AND ROC2 < -n2 AND ROC3 < n3; } else if(n1<0 AND n2>0 AND n3==0)
{
Cond1= ROC1 < n1 AND ROC2 > n2 ;
Cond2= ROC1 > -n1 AND ROC2 < -n2 ; } else if(n1<0 AND n2==0 AND n3>0)
{
Cond1= ROC1 < n1 AND ROC3 > n3;
Cond2= ROC1 > -n1 AND ROC3 < n3; } prch = (C- TimeFrameGetPrice( "C", inDaily, -1 ))/ TimeFrameGetPrice( "C", inDaily, -1 )*100 ; prch6= (C-Ref(C,-6))/Ref(C,-6)*100; Perc = (C-Ref(C,-nn))/Ref(C,-nn); Buy=Cond1 OR Cond2; Sell=!cond1 AND !cond2; Filter = (Cond1 OR Cond2) AND ADX() > 16;// AND C < 2500 ;
AddColumn(Cond1, "Buy",1);
AddColumn(Cond2, "Sell", 1);
AddColumn(C, "Close", 1.3);
AddColumn(Perc, "Change", 1.3);
AddColumn(ADX(),"ADX",1.1);
AddColumn(ROC1, "ROC", 1.1);
AddColumn(ROC2,"ROC-",1.1);
AddColumn(ROC3,"ROC--",1.1);
AddColumn(prch,"prchopen", 1.2);
AddColumn(prch6,"prchlast6", 1.2);



This scan helps to identify stocks which have a trend developing.
For example if your database has stock futures, you can find out which of these stocks are trending positively or negatively. The scan allows you to examine “n” bars, which you can set up in the parameters section – the default is 6. The default rate of change is +0.2 and -0.2.

By default the scan will examine the ROC of price movement for the latest n (default =6) bars for the time frame that you set in Automatic Analysis (which could be 5 minutes, 15 minutes, daily etc).

The output in the scan window will be all those stocks which have an ROC in the last n (default=6) greater than 0.2 or less than -0.2. This will allow you to identify positive trending and negative trending stocks.

The parameters can be changed using the parameters section in the Automatic Analysis window.

By default only the latest n (6) bars are selected in the scan. You can change this also by giving non zero values to ROC2, and ROC3. Lets say these are also set to 0.2 and 0.2. In that case, the scan will result in stocks which meet the criteria – where the the latest n bars, the previous n bars and the ones n bars prior as well to meet the ROC condition that you have setup.

For example if ROC1=ROC2=ROC3 =0.2, and n =6. The scan will show those stocks where the ROC in the three sets of previous 6 bars,(-1 to -6, -7 to -12 and -13 to -18) all have rates of change greater than 0.2 or less than -0.2.

Excellent to identify big trending stocks.

If you experiment with different positive and negative values of ROC1/2/3, you will also be able to identify stocks swinging one direction to the other.

And best part, of course, ability to set any time frame.

The scanned stocks can be put into a new watch list that you can then easily track.

Hope this helps.

No comments:

My Blog List

Total Pageviews

Search This Blog

Followers

Blog Archive