How to place Top 10 and Bottom 10 stocks based on % Change into a watchlist

Dear Seniors,

I wish to place top 10 and bottom 10 performers of the day in to a watchlist and the same has to be updated at a set frequency..

For this, I have used the below mentioned code and generated ranks so far..


_SECTION_BEGIN("Explore All");

Filter=1;

TimeFrameSet(inDaily);
diffd = ( Ref(C,1)/C)*100-100;
TimeFrameRestore();
diffd1=TimeFrameExpand(diffd,inDaily);

SetSortColumns(-4);
AddRankColumn();
AddColumn(C,"Close",1.2);
AddColumn(diffd1,"daily chg",1.2, textcolor=IIf( Ref(C,-1) > C,ColorRed,ColorBlue)) ;

_SECTION_END();


Once the ranking is done, I just want the top 10 and bottom 10 stocks to be pushed to a watchlist as long as it in auto scan.. Kindly suggest..

Thanks in advance..

Read through this thread and you'll get the gist of the approach you need to take.