contango.stream.indicators.state.sma_state
contango.stream.indicators.state.sma_state
SMAState
Bases: Enum
The position of the fast SMA relative to a slow SMA.
Attributes:
| Name | Type | Description |
|---|---|---|
BELOW |
The fast SMA below the slow SMA. |
|
ABOVE |
The fast SMA is above the slow SMA. |
get_state
classmethod
get_state(fast_sma: float, slow_sma: float) -> SMAState
Returns the SMA state of the fast SMA relative to the slow SMA.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fast_sma
|
float
|
The value of the fast SMA for the current bar. |
required |
slow_sma
|
float
|
The value of the slow SMA for the current bar. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
SMAState |
SMAState
|
Whether the fast SMA is above or below the slow SMA. |
Source code in src\contango\stream\indicators\state\sma_state.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |