It is really necessary to test strategy by using walk forward optimization to get sustainable performance statistics of a strategy. For example, standard IS/OOS (In-Sample/Out-Of-Sample) optimization is just a 1-step Walk Forward Optimization. IS/OOS gives you bias performance because it only depends on IS and OOS performance and you have a high probability of overfitting and to escape it you can apply Walk Forward Optimization.

I expand Bollinger Bands strategy logic with a trigger that allows you to use inverse trades (go long instead of short and vice versa). Strategy code and example can be found here in order to replicate the results.
We will choose Gazprom stock downloaded from Finam data source from 2016 till the end of 2019; Sharpe Ratio optimization metric with zero interest rate and look at the strategy optimized for the 2016–2018 period and tested in 2019 period.









Now we move to Walk Forward Optimization. We will calculate rolling performance with 24 months window and collect best strategy parameters by Sharpe Ratio monthly on the 1st day of the month:


