IIndicatorsAccessor.CenterOfGravity
method · IIndicatorsAccessor · cAlgo.API.Internals
DesktopCLICloud
The Center of Gravity (COG) indicator is a technical indicator developed by John Ehlers in 2002, used to identify potential turning points in the price as early as possible.
Definition
CenterOfGravity CenterOfGravity(int length)
api.Indicators.CenterOfGravity(length: int) -> CenterOfGravity
Parameters
| Name | C# type | Python type | Description |
|---|---|---|---|
length | int | int | The length of CenterOfGravity |
Returns CenterOfGravity — CenterOfGravity
Examples
var centerOfGravity = Indicators.CenterOfGravity(10);
Print("Center of Gravity: {0}, lag: {1}", centerOfGravity.Result.LastValue, centerOfGravity.Lag.LastValue);
centerOfGravity = api.Indicators.CenterOfGravity(10)
api.Print(f"Center of Gravity: {centerOfGravity.Result.LastValue}, lag: {centerOfGravity.Lag.LastValue}")