Trade one item over days of prices, with a rest day after each sale or a fee on it: a small state machine (free, holding, cooling down) and a table with one row per state and one column per day, then the best plan traced back. The table takes one cell per state per day; plain recursion nearly doubles its calls with every day.
This interactive visualization needs JavaScript.