Yes, that's bad. But the enterprise is doomed even earlier than that: the author is using a naive regression technique on timeseries data. Stock price data is typically log-normally distributed and non-stationary. If the author is not going to use a robust timeseries technique like ARIMA, they need to transform and constrain the data to account for non-stationarity. Otherwise it's trivial to find superfluous correlations which appear to show a strong linear relationship between some fundamental financial metric and some other technical indicator, because both may have a temporal component (e.g. stocks tend to go up over time, and a lot of technical indicators have some implicit component which also increase or decrease with time).
This is also why it's important to have a strong fundamental thesis to explain what's going on.
Also you might need to get into Panel Data methods when you are evaluating more than one stock
Moreover, if you are just looking at the direction of daily movements (up or down), the series of moves fits a geometric distribution very well, with a slight bias in the up probability than the down one.
But regardless, the fix you're suggesting is correct. You can't just take random days out of order.
Even though daily returns show low acf/pacf, stocks show trends in the magnitude of their returns, but not necessarily their direction. For example, a given stock could be popping off with strong upward momentum, and still be down half the days. It's just that the returns are greater on the upside than downside.
You see this kind of incorrect thinking a lot with people who don't work in quant finance: they try and predict the direction and sometimes magnitude of returns.
In real life, no one actually does this, as it is practically impossible. Instead, you try and construct a portfolio in which you are exposed to some factor in which you think is correlated to out-performance.
I personally think believe that forecasting direction and magnitude to be literally impossible with ML methods in daily data. I (and everyone else) has come to this conclusion after many failed attempts with every ML/AI tool in existence.
Fortunately, it turns out you don't really need to forecast returns to deliver alpha and superior risk-adjusted returns. It's just the most obvious thing to do for people new to finance, but experienced with ML.
I agree with your broader point that this analysis is bad, though. Another criticism is that he's predicting class labels, but not accounting for magnitude. It is possible to be able to predict the direction of the market tomorrow, with say, 60% accuracy, and still not be able to make money. If you can predict up/down with 60% accuracy, and on average when you're right you make 1%, and when you're wrong you lose 10%, you still have a bad strategy.
For those interested in time series analysis I just finished a small project with the help of Introduction to Time Series Forecasting with Python by Jason Brownlee.
The relevant section is 24.4 Rolling Forecast ARIMA Model.
Reminds me of https://xkcd.com/882/
The key problem with their analysis is that they don't do a proper train-test split. All of their results are probably just overfitting on the training. You know that they are doing an incorrect train/test split because they are using train_test_split from the sklearn library, which is only designed to work on independent data. However, stock prices are highly correlated with each other. In order to get a true "independent" test set you have to do a time split where all the test set values are from the future and all of the training set values are from the past.