Mean Reverting Bollinger Band


I am working on the GLD-GDX example from ‘Mean Reversion Strategies In Python’.

I would appreciate help understanding the logic of how the BB on the spread, is mean reverting. As the BB seems more trending on this example than mean reverting. (attached plot)

Thanks.
Shay.

# Long
df['long_entry'] = df.spread < df.lower_band
df['long_exit'] = df.spread >= df.moving_average
# Short
df['short_entry'] = df.spread > df.upper_band
df['short_exit'] = df.spread <= df.moving_average
df[['spread','moving_average','lower_band','upper_band']].head(100).plot.line(figsize=(20,10)).grid()

Plot

Hi Shay,



The series might seem to trend if you see it in the shorter time period but as you take the longer duration you would be able to visualize the mean-reverting nature of the series. The same has been illustrated in the Jupyter notebook wherein a longer duration is taken. Also to check it statistically you can do an ADF test. The explanation for the same has been provided in Section - 3 of the course.



Hope this helps!



Thanks,

Akshay