It is impossible to see the future! Writing some code to predict it, is definitely not going to work.
This is why your "bot" fails.
We aren't yet in the unpredictable territory either. I'd say at the time being because of the halving and the similar patterns in history we are in a more predictable phase where speculation about the price is easier in comparison to other times when certain events cause unpredictable volatility.
We'll eventually get there, success after all is a compilation of mistakes (that's not repeated), we will eventually be able to predict prices and I think that they're probably doing this too with the Stock Market, if you can corroborate human behavior and the previous market for that time and arrive at a conclusion, there's a chance that you can predict what can happen, of course this won't be true in the cases of market manipulation but if we're just talking about the invisible hands of the market then AI will able to eventually predict how the market will move, AI isn't perfect yet but we humans will eventually come to that point.