The only way to use machine learning with stock price is Direct Forecasting. Using machine learning without Direct Forecasting will definitely cause data leak or even target leak. Regarding the pipeline you are using in this video, it is has nothing to do with prediction because the loop you are using to create the target does not look one stop ahead (i+1), but looks on the current step(i). Your pipeline is rather useful for descriptive analysis and perhaps creating trading rules.
The only way to use machine learning with stock price is Direct Forecasting. Using machine learning without Direct Forecasting will definitely cause data leak or even target leak. Regarding the pipeline you are using in this video, it is has nothing to do with prediction because the loop you are using to create the target does not look one stop ahead (i+1), but looks on the current step(i). Your pipeline is rather useful for descriptive analysis and perhaps creating trading rules.
Need code and dataset