Problem to maximize profit for a prescient stock trader