### General things

- You can do some mathematics functions on boolean column. True equals to one (1), False equal to zero (0)

### How many times a condition is True in the last x candles

`(<condition to be checked>).rolling(x).sum()`

If the sum is zero (0), that means the condition is always False in the last x candles. If the sum equals to x, that means the condition is always True in the last x candles. If the sum is between zero and x. that means the condition is only true for that amount in the last x candles. This method won’t be able to tell you

- How many consecutive True/False in the last x candles
- The index of candles with True/False

### Whether the condition is always True in the last x candles

`(<condition to be checked>).rolling(x).min() > 0`

### Whether the condition is always False in the last x candles

`(<condition to be checked>).rolling(x).max() < 1`

[…] Simple Pandas Snippets […]