BBands Strategy

Course Name: Quantitative Trading Strategies and Models, Section No: 2, Unit No: 19, Unit type: Notebook

Hello,

Why are we using as condition for BUY: yesterday's returns > NEGATIVE yesterday's std? We should

https://i.imgur.com/wo43FL8.png

It doesn't have any sense for me... 

Hi Daniel,



We are looking for the daily return which is lower than the first standard deviation.

In the lower side, the price declined and we got negative returns. But standard deviation values will be positive. (Standard deviation is a measure of the amount of variation or dispersion in a set of values. It is defined as the square root of the variance, and since variance is always non-negative (being an average of squared differences), the standard deviation is also always non-negative.)



This is why we add a negative sign to the standard deviation value.



Hope this helps.

And it would be valid to compared in the lower side the absolute values of returns vs std deviation returns?



Like this:

np.abs(data["returns"]).shift(1) > np.abs(data["r_std"]).shift(1)

 

Hi Daniel,



You make a fair point. Technically, it should work. But you can backtest the strategy with the change and check if there is any difference in the performance. This will help you understand if it indeed works.



Hope this helps.

Thank you, Rekhit.