Hello, Rather than reinvent the wheel I am trying to identify a formula that will optimize the amount of stock to hold for a stock that oscillates between 1 and 100. At $1 we want to be 100% invested in the stock. At $100 we want to be all cash. Is there a formula that would optimize this process? A very simply option may be to hold the following % of stock at these points. How do I translate this to a formula? I assume I would want to buy at lower pricepoints than I sell at so we set the following table to buy on the way up and have another table to buy on the way down. In theory this works, but there must be a formula to automate this. Buy on way up Price % Invested $0 0% $10 10% $20 20% etc $90 90% $100 100% Sell on way down Price % Invested $100 100% $92 90% $82 80% $72 70% etc $22 20% $12 10% $0 0% Any help would be appreciated.