cg
Center of Gravity.
The Center of Gravity indicator, in short, is used to anticipate future price movements and to trade on price reversals as soon as they happen. However, just like other oscillators, the COG indicator returns the best results in range-bound markets and should be avoided when the price is trending. Traders who use it will be able to closely speculate the upcoming price change of the asset.
Example:
from openbb import obb
stock_data = obb.equity.price.historical(symbol="TSLA", start_date="2023-01-01", provider="fmp")
cg_data = obb.technical.cg(data=stock_data.results, length=14)
Parameters
- Standard
| Name | Type | Description | Default | Optional |
|---|---|---|---|---|
| data | List[Data] | The data to use for the COG calculation. | None | False |
| index | str | Index column name to use with data, by default "date" | date | True |
| length | PositiveInt | The length of the COG, by default 14 | 14 | True |
Returns
The COG data.