I built a script to automatically re-balance a basket of commodities when prices go up or down. Kind of like a 401k, I have a target allocation for each. I track my average cost of each commodity, and sell an amount of shares for a particular commodity when it's price is high and buy an amount when it's low. The goal is for the algo to maintain a target allocation, accumulate shares when they are cheap, and sell for profit when they are high. I use a high and low threshold of 5% to trigger orders.
I wanted to ask this community, what do you think of this strategy? Does someone have a recommendation on how to backtest this? How to optimize the threshold?
Submitted September 28, 2020 at 09:44PM by policybreh