@prakashmodak, since you plan to upgrade, I’m posting this code snippet to reward your good will, but… you should learn ASAP to program basic.AFL as suggested in the previous answers.
Actually, to write this code, I followed @Milosz precious suggestions: you should have done the same since the was already a piece of code by @fxshrat that does what you want.
Here in the forum there are some VERY talented coders that will help you to learn how to code (start from this thread) but to get answers you should do a serious effort to study the basics, read the forum topics, search for already posted solutions and then, if still lost, request help here!
/// Based on code posted on the forum by fxshrat
/// @link http://forum.amibroker.com/t/how-to-find-out-the-ordinal-number-or-name-of-the-watchlist-in-which-symbol-is-being-dispalyed/1590/3
// This function return a string that includes all the numbers and names of
// the watchlists that include the currently selected ticker in the format:
// #, WLName; #, WLName; #, WLName; etc. (# is the WL ordinal)
function getWLList(start, end)
wlstr = "";
category = categoryWatchlist;
for( i = 0; CategoryGetName( category, i ) != ""; i++ )
if( InWatchList( i ) )
catname = CategoryGetName( category, i );
if( wlstr != "" )
wlstr = wlstr + "; ";
wlstr += WriteVal( CategoryFind( catname, category ), 1 ) + ", " + catname;
cond = C > Ref( HHV( C, 20 ), -1 ) AND V > Ref( V, -1 ) * 1.2;
Filter = cond;
AddTextColumn(getWLList(), "WL", 1.2, colorDefault, colorDefault, 400);
Keep in mind that this code could be slow (it needs to parse a lot of strings).
This code could be improved, but probably it is enough for your usage.