using two indexes to find the maximum profit of stock.