Functions
talib.cog()
Centre of gravity of `source` across a window of `length` bars.
Syntax
talib.cog(series float source, series int length) → series float
Arguments
source required series float The series to measure. length required series int How many bars the window covers. 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)