DetrendedPriceOscillator

Calculates the DetrendedPriceOscillator indicator.

Accepts the following parameters:

Parameter NameTypeDefault ValueNotes
periodNumber21-

Returns: Series<Number>

DetrendedPriceOscillator is a built-in function - you can use it directly. Below is an example implementation:

123
function DetrendedPriceOscillator(period = 21):
offset = Math.Floor(period / 2) + 1
close[offset] - SMA(close, period)