I would like to make a new column called "trigger" in a dataframe. The trigger condition is based on three consecutive days bullish condition such as:
df["bullish"] = (df["price_change"] > 0)
I like to make:
df["trigger"] = (three consecutive day df["bullish"] is True, but I don't know how to do it)
Is it possible to make a trigger condition using 3 consecutive days in pandas vectorized way?
Do you have any suggestions?
I've attached a notebook for your exercise.