DPO removes the longer-term trend by comparing price to a displaced moving average, leaving the shorter cycles behind. It is used to spot the length and timing of price cycles — peaks and troughs — rather than to follow trend direction. Copy the version for your platform.
{DPO - Detrended Price Oscillator, period 20}
dpoVal := DPO(20);
dpoValTo use it inside dtcharts, paste any version into the Script Converter and it becomes a native indicator on your chart.