trading.indicators.state.sma_state
trading.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\trading\indicators\state\sma_state.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | |