Detrend (Function)

image\trumpet2.gif Disclaimer

The Detrend function calculates the detrended value of a price from an offset average of the price.

Syntax

Detrend(Price,Length)

Returns (Double)

The numeric detrend value for the current bar.

Parameters

Name

Type

Description

Price

Numeric

Specifies which bar value (price, function, or formula) to consider for the detrended average.

Length

Numeric

Sets the number of bars to consider for the detrended average calculation.

Remarks

The detrend average offset is half of the average length plus one.

The input parameter Price can be a bar value such as Close, High, Low, Open, or Volume. It can also be any mathematical calculation such as High + Low) / 2, or a numeric function such as RSI, Stochastic, or ADX.

The value for the Length input parameter should always be a whole number greater than 0.

Example

Assigns to Value1 the detrended price value for the Close from the 14 bar average of the Close, then plots Value1:

Value1 = Detrend(Close, 14);

Plot1(Value1, "Detrend");