indicator · own pane · open source
Detrended Price indicator
Detrended Price is a free open-source indicator by @deepwick. Detrended Price (DPO) removes the trend from price by subtracting the SMA shifted forward… Deepwick Script runs a subset of Pine Script.
Running…
Loading chart…
What Detrended Price does
Detrended Price (DPO) removes the trend from price by subtracting the SMA shifted forward by half the lookback. Shows short-term cycles around the trend.
- Zero-line crosses flag short-term momentum shifts.
- Peaks above zero and troughs below zero identify cycle extremes.
- Use on equities/indices with clear cyclical behaviour.
Source code
Deepwick Script, a subset of Pine Script · read-only
//@version=6
indicator("Detrended Price", overlay=false)
len = input.int(20, "Length", minval=2, maxval=200)
src = input.source(close, "Source")
colorMid2 = input.color("color.teal", "Color Mid2")
colorDown = input.color("color.red", "Color Down")
colorNeutral = input.color("color.gray", "Color Neutral")
dp = src - ta.sma(src, len)[math.floor(len / 2)]
hline(0, "Zero", color=colorNeutral, linestyle=hline.style_dotted)
p_DPO = plot(dp, "DPO", color=dp >= 0 ? colorMid2 : colorDown, style=plot.style_columns)
alertcondition(ta.crossover(dp, 0), "DPO crosses zero up", "Detrended price crossed above zero")
alertcondition(ta.crossunder(dp, 0), "DPO crosses zero down", "Detrended price crossed below zero")
No comments yet.
Sign in to comment.