buy top 3 stocks that have top value (Price * Volume)

If I have 5 stocks in my list. (a,b,c,d,e)

I want to buy top 3 stocks that have top value (Price * Volume)

Example
A = 10M value
B = 9M value
C = 8M value
D = 7M value
E = 6M value

How can I write afl code to buy "A" then "B" then "C" or buy these "A","B","C" stocks at the same time ?

@cecil you need to learn about the various methods available for "Ranking".

https://www.amibroker.com/guide/h_ranking.html

Make a few attempts, and if you get stuck post your solution and where you are getting stuck.