Indicator: Dinapoli preferred Detrended-Price-Oscillator (DDPO)
The oscillator indicates level of overbought (OB) and oversold (OS). The DDPO calculation produces a signal line that oscillates above and below zero to indicate level of OB/OS.
Regards,
Fortcentral
----------------------------------------------------------------------------
Oscillator Display Customisation:
The calculated oscillator signal is displayed in a panel at the bottom of a price chart, with the following (automated) horizontal display lines to provide a visual guide of the oscillator displacement from the zero line:
1) the (horizontal) zero line
2) the maximum oscillator positive and negative value corresponding to the maximum overbought (max.OB) and minimum oversold (min.OS) value within a "z.period" oscillator calculation lookback period (described further below).
3) The "avg.max.OB" line, which is the "average maximum overbought level"; derived from the average value of "x" number of the highest oscillator peak values chosen in (descending) order of magnitude, within a defined "z.period" oscillator calculation lookback period (described further below).
4) The "avg.min.OS", which is the "average minimum oversold level"; derived from the average of "y" number of the lowest oscillator trough values chosen in ascending order of magnitude within the defined "z.period" oscillator lookback period (described further below).
5) A dotted line showing a user-definable-percentage "a%" value of the "avg.max.ob" and the "avg.min.os" value within a "z.period" oscillator calculation lookback period (described further below).
------------------------------------------------------------------------------
--> Price Source: Bar
--> User Input Parameters:
1) "n.period" is total number of price bars used in the oscillator calculation, i.e. the simple moving average (SMA) lookback period. It is "7" by default but can be any integer number.
2) "z.period" is the lookback period within the oscillator calculation to generate display of max/min/average values of OB/OS levels. Default is "135" periods.
3) "Price" option for oscillator calculation. User-definable to use either the High, the Low or the Closing Price of each price-bar as the basis for the oscillator calculation. Default is "closing price" of each bar.
4) "SF" is a scaling factor; an Integer which can be a decimal number also. Default value is "1.0". This parameter scales the DDPO oscillator line to make it suitable for display across various instruments.
5) "x" is the number of the highest peaks in the DDPO line (in descending order of magnitude) within the "z.period" lookback of the oscillator calculation, used to derive the "avg.max.OB" (as described above) value. Default value is "3" peaks.
6) "y" is the number of the lowest troughs in the DDPO line (in asceding order of magnitude - as they are negative values) within the "z.period" lookback of the oscillator calculation, used to derive the "avg.min.OS" (as described above) value. Default value is "3".
7) "a%" -> this is a percentage value of "avg.max.OB" and "avg.min.OS" within the "z.period" lookback of the oscillator calculation, displayed as dotted horizontal guide lines. Default value is "60%" of "avg.max.OB" and "60% of "avg.min.OS"
8) Option to choose line thickness, style and colour for DDPO oscillator line display
9) Option to turn on display and choose colour and line style for "max.OB", "min.OS", "avg.max.OB", "avg.min.OS" and "a%" lines within oscillator display panel.
************************************************************************************
--> Dinapoli preferred Detrended-Price-Oscillator (DDPO) Calculation:
DDPO(time) = SF*[Price(time)-(n.period.SMA of Price)]
************************************************************************************
Notes:
(1) DDPO(time) is the current time-period Dinapoli preferred Detrended-Price-Oscillator value
(2) SF is the scaling factor as defined above
(3) Price(time) is the current time-period price
(4) "n.period.SMA" is the "n.period" simple moving average value of price. SMA is the simple moving average calculation of the last n-prices inclusive of the current price, i.e. n.period.SMA = {[P(1)+P(2)+P(3)+......+P(n)]/n}.