Guides, manuals and platform references.
Published 2026-11-05 · Author: AlgoWay
A centered Detrended Price Oscillator can look wonderfully punctual on an old chart. The trouble begins when the reader mistakes the location of the line for the time its value became knowable. A calculation drawn on an earlier candle was not necessarily available on that candle.
That distinction matters before TradingView automation turns a condition into an order. In an AlgoWay TradingView-to-MT5 workflow, review the signal's information timestamp before connecting execution. Routing a signal cannot make its inputs available earlier.
TradingView describes DPO as a tool for examining historical cycles rather than a conventional momentum signal. Its documented calculation subtracts an N-period simple moving average from the price N/2 + 1 periods earlier. The Centered setting moves the displayed line left; disabling it brings the line back toward current prices. See TradingView's DPO reference.
Keep two questions separate: which prices produced the number, and where the chart draws that number? Changing the second does not give the first an earlier publication date.
Use a 20-bar lookback and closing prices. The displacement is 20/2 + 1 = 11 bars. Label the latest completed candle bar 100. The calculation available there is:
DPO calculated at bar 100 = Close at bar 89 - SMA(20) at bar 100
Suppose, purely for illustration, that bar 89 closed at 105 and the average of closes from bars 81 through 100 is 102. The result is +3. If plotted 11 bars left, that +3 appears at bar 89. But its average contains closes from bars 90 through 100, which had not happened when bar 89 ended.
| Item | Bar in this example | Meaning |
|---|---|---|
| Price being compared | 89 | The older close of 105 |
| Final input to the average | 100 | Completes the average of 102 |
| Centered display location | 89 | Where the +3 is drawn |
| Earliest completed-bar decision using these inputs | 100 | When this particular calculation is available |
This is arithmetic with invented prices, not a backtest or a claim about market performance. StockCharts' DPO explanation describes the same relationship from the historical bar's viewpoint: price is compared with an average from later bars. It also explains why a centered DPO does not extend to the latest date.
In Pine Script, a negative plot() offset displays values on earlier bars. It does not move the underlying calculation or an order instruction into the past. That display behavior is documented in Pine's plot reference.
For example, drawing a calculation with an offset of -11 and evaluating a condition on that calculation are separate operations. A marker placed beneath bar 89 is insufficient evidence that a strategy could have entered at bar 89. The evidence would need to show that the condition used only information available then.
Turning off centering can make the timing easier to inspect. It does not turn an older-price comparison into a comparison between today's close and today's average. Read the script's formula as well as its display settings.
For a proposed DPO rule, write down the lookback, price source, displacement and decision time. Then choose one candidate signal and trace its inputs. In the example above, an entry assigned to bar 89 would fail that audit because its average needs bar 100.
If the intended rule is a zero crossing, distinguish the crossing in the calculated series from the crossing's shifted drawing. Record the bar when the rule was evaluated and compare that with the alert event. Do not judge timing solely from a screenshot after all candles have closed.
An unshifted plot also does not settle every timing issue. A rule that uses another timeframe has a separate confirmation question, covered in higher-timeframe Pine alerts. Resolve both questions when both apply.
Centered DPO remains useful for studying the spacing of historical peaks and troughs. That research use does not establish a profitable entry rule. A sensible automation review asks a narrower question first: could this exact decision have been made with the information available at its recorded time?