AFL code for watchlist creation

I have a strategy which i want to run on a watchlist and short list the stock with maximum cumulative profit and put it in a new watchlist

Any Idea?