Return value of the Detrented Price Oscillator technical indicator over N periods.
Syntax:
Calculation of a DPO (n period)
First, calculate the (n period) moving average
Then it is necessary to move back the data of this average of n/2+1) days ago.
Indicator DPO is finally : (close – Data of the moving average (n/2+1) days ago).
This indicator reduces the price trend and cycles become more visible.
While visualizing the tops and the bottoms, the DPO emphasizes the cycles.
Example:
|
myDPO = DPO[21](typicalprice) FOR i = 1 TO 10 DO if(myDPO[i]>value) THEN value = myDPO[i] ENDIF NEXT if(myDPO>value) THEN extremebullish = 1 ELSE extremebullish = 0 ENDIF RETURN extremebullish COLOURED(124,252,0) |