If you buy a stock, you must keep (hold) it for eg. 30 days (or 7, or 60, or whatever).
Compute all you want, whenever you want, but instead of millisecond timings, optimize stuff for at least some time.
Maybe even a tax on stock profits, which is really high and falls after some time of ownership of such stock (we have this in slovenia, but it's not really high in the first place, and time brackets go less than 5 years (25%), 5-10 years (15%), 10-15 years (10%) , 15-20 years (5%), and zero tax after that.