Displaying symbol’s watchlist membership on chart

I’m discretionary trader, hopeless with AFL, and I use Amibroker for scanning and charting. I have number of watchlists, and when I click on a symbol, I need to know names of the watchlists the symbol is a member of (so I can then manually add/remove/copy the symbol between watchlists as required).

One the way to get this information is to right click on the symbol and select “Watch list” > “Remove selected symbols(s), I get a dialog box with the watch lists which have the symbol.

I’d like to have the names of the watch lists that the symbol is a member of displayed on the chart title itself (preferably in the top right corner). I’ve tried the following:

WriteIf( InWatchListName("Flagged"), "Flagged", "   " );
WriteIf( InWatchListName("Basing"), "Basing", "   " );

And also:

prinf( InWatchListName("Flagged"), "Flagged", "   " );

but I’ve spent hours on it and cannot get it to display on the chart.

Would someone please advise me what I’m doing wrong?

Thank you very much.

Hi @FXtrader, here's the code that I use to do what you want to achieve:

_SECTION_BEGIN( "InWatchlist" );

WatchListsStr = "";

for( i = 0; CategoryGetName( categoryWatchlist, i ) != ""; i++ )
    if( InWatchList( i ) )
        CategoryName = CategoryGetName( categoryWatchlist, i );
        WatchListsStr += CategoryName + "   ";

GfxSetOverlayMode( 0 );
GfxSetTextAlign( 0 | 24 );
GfxSelectFont( "Calibri", 11, 700 );
GfxSetTextColor( colorGreen );
GfxTextOut( "" + WatchListsStr , 4, Status( "pxchartbottom" ) - 20 );


It displays all the watchlists that the currently selected symbol belongs to, like this:


You can modify it to suit your personal preferences.



Or use this one with output to Interpretation window

Slightly modified

/// @link https://groups.yahoo.com/neo/groups/amibroker/conversations/messages/184020
/// @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
wlstr = "";
category = categoryWatchlist;
format1 = "\n<i>#WL:</i> <b>%g</b>, <i>WL Name:</i> <b>%s</b>";
format2 = "%s<b>No Watchlist Memberships!</b>%s";
format3 = "%s<b>Watchlist Membership(s):</b>%s%s";
for( i = 0; CategoryGetName(category, i) != ""; i++ ) {
	if( InWatchList( i ) ) {
		catname = CategoryGetName(category, i); 
		wlstr += StrFormat(format1, CategoryFind(catname, category), catname);      
if( wlstr == "" )	result = StrFormat(format2, EncodeColor(colorRed), EncodeColor(-1) );
else				result = StrFormat(format3, EncodeColor(colorGreen), EncodeColor(-1), wlstr );




Fantastic, thank you to both of you, I really appreciate it.

1 Like

Thanks for sharing both of you. These are very helpful!


This topic was automatically closed 100 days after the last reply. New replies are no longer allowed.