trading.indicators.state.bollinger_bands_state
trading.indicators.state.bollinger_bands_state
BollingerState
Bases: Enum
Current price location relative to Bollinger Bands.
Attributes:
| Name | Type | Description |
|---|---|---|
BELOW_LOWER |
The price is below the lower bollinger band. |
|
BETWEEN_LOWER_AND_MIDDLE |
The price is between the lower & middle bollinger bands. |
|
BETWEEN_MIDDLE_AND_HIGHER |
The price is above the middle bollinger band but below the higher one. |
|
ABOVE_HIGHER |
The price is above the higher bollinger band. |
get_state
classmethod
get_state(current_price: float, bands: BollingerBandSnapshot) -> BollingerState
Returns the band zone that the price is currently in.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current_price
|
float
|
The price for the current bar. |
required |
bands
|
BollingerBandSnapshot
|
The snapshot of bollinger bands for the current bar. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
BollingerState |
BollingerState
|
The state enum of the price relative to the bollinger bands. |
Source code in src\contango\trading\indicators\state\bollinger_bands_state.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |