The aim of this algorithm is to capture slight moves in the bid/ask spread as they happen. It is only intended to work for high-volume stocks where there are frequent moves of 1 cent exactly. It is one of the trading strategies based on order book imbalance. For more details about it, please refer to Darryl Shen, 2015 or other online articles. This algorithm will make many trades on the same security each day, so any account running it will quickly encounter PDT rules. Please make sure your account balance is well above $25,000 before running this script in a live environment.