Lipi Reference Lipi

Functions

talib.cog()

The cog (center of gravity) is an indicator based on statistics and the Fibonacci golden ratio.

Syntax

                talib.cog(series float source, series int length) → series float
              

Arguments

source required series float Series of values to process.
length required series int Number of bars (length).

Return Type

series float

Example


          indicator("Center of Gravity (COG)", overlay=false)
// Input length for calculation
length = input(10, title="COG Length")
// Compute the COG value
cogValue = ta.cog(close, length)
// Plot the COG line
plot(cogValue, title="COG", color=color.blue, linewidth=2)