# Given (past) stock values for N assets, how to find the maximum - theoretical - profit?

In the past few days I have been thinking about a question which seems trivial, yet I can't think of any efficient way to find the optimal solution...

Here is the problem: imagine you have a portfolio which can be composed of up to N different assets (N being quite small, like 5 or 6). You have X dollars to invest at time t0. You can only sell assets that you have previously bought (no shorting), however you buy and sell (without fees) as many times as you like (within the limits of your portfolio). Now if you know the stock values of these 5 assets between t0 and T, is there an (efficient) way to calculate the trading sequence that would give the maximum profit at time T?

I have tried to look if others have had the same question, but I haven't found any relevant answer: either I have been looking for the wrong keywords or no-one has looked into the problem ... (which is understandable since one would need a time-machine for it to have a practical use!)

• At every tick ($t$) find the assert ($A$) that's most profitable ($max(A_{t+1} / A_t)$); sell all other assets, buy/continue holding this asset. – amsh Oct 11 '15 at 14:25
• Echoing the response of @amsh , you have a perfect crystal ball. Just buy low and sell high with precision. It's no wonder nobody studies this kind of problem (hence when you searched for keywords, nothing shows up) since the solution to the problem is obvious, and more importantly, the problem is not interesting. – user32416 Oct 11 '15 at 17:47
• Even with only two assets: One stock and T-bills, and once a day trading, you can generate triple digit returns per year: just hold the stock if it will go up tomorrow, or hold the Tbill otherwise. – Alex C Oct 12 '15 at 3:35