Skip to content

    Detrended Price Oscillator (DPO): A Practical Guide for Indian Traders

    Quick answer

    How the Detrended Price Oscillator works, with a fully worked Reliance example finishing at a real DPO number, best settings for Nifty, and Indian F&O tax.

    19 June 2026
    13 min read
    2,534 words

    Key Takeaways

    • 1.The Detrended Price Oscillator (DPO) strips out the longer trend so you can see the rhythm of short price cycles, which is its only job.
    • 2.For a 20-period DPO the formula is: DPO = Close from (20/2 + 1) = 11 bars ago, minus today's 20-period Simple Moving Average. The lookback shift is the part most traders get wrong.
    • 3.The DPO is displaced (shifted back in time), so it is NOT a real-time signal and it repaints at the right edge. Never use the last few bars for live entries.
    • 4.It works best on range-bound, mean-reverting names and indices like Nifty in a sideways month, and poorly in strong one-way trends.
    • 5.In India, F&O profits using DPO timing are taxed as business income at your slab, not as STCG. Plan your taxes around that, not around the 20 percent equity STCG rate.

    What the Detrended Price Oscillator Actually Measures

    The Detrended Price Oscillator (DPO) answers one narrow question: where is price right now compared with where the trend says it should be a few bars ago? It does this by taking a price from the past and subtracting a moving average centred on that same period. Because the average represents the trend, subtracting it removes the trend and leaves only the wobble, the cycle, around that trend. That residual wobble is what oscillates above and below the zero line.

    This makes the DPO fundamentally different from momentum tools like RSI or MACD. MACD measures the gap between two moving averages and reacts to trend strength. RSI measures the speed of recent gains versus losses. The DPO does neither. It is a cycle-isolation tool, built to help you estimate how many trading days typically pass between one swing low and the next on a given instrument, so you can anticipate the next turn rather than chase it.

    Because of how it is built, the DPO is deliberately shifted backward in time. That shift is the single most misunderstood feature of the indicator, and it is the reason the DPO should never be your trigger for a live order. We will return to this point with numbers, because it changes how you trade with it.

    The DPO Formula, Written Out Properly

    The standard formula for an N-period Detrended Price Oscillator is: DPO = Closing price from (N divided by 2, plus 1) bars ago, minus the current N-period Simple Moving Average. The displacement, the number of bars you step back to pick the price, is (N/2) + 1. For the popular 20-period setting that is (20/2) + 1, which equals 11 bars.

    So a 20-period DPO does not compare today's close with today's average. It compares the close from 11 trading sessions ago with today's 20-period SMA. The average sits roughly in the middle of the 20-bar window, and the displaced price sits at that same midpoint, which is exactly why the trend cancels out and only the cycle remains. Many charting platforms, including TradingView, draw this as a displaced line, so the most recent 11 bars of the DPO are intentionally left blank or shown faintly. That blank tail is not a bug.

    • Pick a period N. 20 is standard. The cycle you can detect is roughly half of N, so a 20-period DPO highlights cycles of about 10 trading days.
    • Compute the N-period Simple Moving Average for the current bar.
    • Step back (N/2 + 1) bars and take that older closing price.
    • Subtract: older close minus current SMA. The sign and size of that number is the DPO.

    A Fully Worked Example on Reliance, With the Final Number

    The earlier version of this page set up an example and then stopped before the answer. Here we finish it. These prices are illustrative and chosen for clean arithmetic, but the method is exactly what your platform runs. Suppose we track Reliance Industries (NSE: RELIANCE) on the daily chart with a 20-period DPO. We need 20 consecutive closing prices. Label them Day 1 (oldest) to Day 20 (today).

    DayClose (Rs)DayClose (Rs)
    11380111430
    21392121438
    31405131451
    41398141462
    51410151455
    61422161468
    71418171480
    81435181475
    91428191490
    10144220 (today)1502

    Step 1, the 20-period SMA. Add all 20 closes. The total of the figures above is Rs 28,881. Divide by 20: 28,881 / 20 = Rs 1,444.05. That is today's 20-period Simple Moving Average.

    Step 2, the displacement. For N = 20, step back (20/2) + 1 = 11 bars from today. Today is Day 20, so 11 bars back lands on Day 9, where the close was Rs 1,428. (Day 20 minus 11 equals Day 9.) This is the older price the formula wants, not today's close.

    Step 3, subtract. DPO = displaced close minus current SMA = 1,428 minus 1,444.05 = minus Rs 16.05. So today's plotted DPO value is about -16.05. Note that platforms plot this value at the displaced position (11 bars back), not under today's candle.

    What the -16.05 tells you

    A negative DPO means that 11 sessions ago, Reliance was trading roughly Rs 16 below where its 20-day trend now sits. The cycle low was likely behind us, and price has since recovered toward and above the average. If the DPO had been a large positive number, it would say price was stretched above trend at that midpoint, a typical spot to expect a cyclical pullback.

    Reading the Zero Line and the Swings

    The zero line is where the displaced price equals the average, meaning price is sitting exactly on its trend. A DPO above zero says price at that midpoint was above trend; below zero says it was below trend. But the real value of the DPO is not the cross itself, it is the distance between peaks and troughs measured in days. If RELIANCE keeps making DPO troughs about every 9 to 11 sessions, you have measured its short cycle, and you can pencil in roughly when the next swing low is due.

    On Nifty in a sideways monthly range, traders often find the 20-period DPO oscillating fairly symmetrically. The practical move is to note the typical peak-to-peak spacing, then watch for the DPO to roll over near a prior peak height. That is a cleaner read than waiting for a zero-line cross, because the cross lags the actual turn by construction.

    Crucially, because the plotted line is shifted back 11 bars, the right-hand edge of the DPO is empty. You are reading history to anticipate the future, not getting a fresh signal on today's candle. Treat the DPO as a planning tool, then use a non-displaced trigger such as a price break or an RSI cross for the actual entry.

    DPO Versus Momentum Oscillators

    It helps to be precise about where the DPO sits among the tools most Indian traders already use. The table below contrasts purpose, what each measures, and the main weakness.

    ToolWhat it measuresReal-time?Main weakness
    DPOShort price cycle length, by removing the trendNo, it is displaced back ~N/2 barsUseless in strong trends; lags by design
    RSISpeed of recent gains vs losses (0 to 100)YesStays overbought for long in trends
    MACDGap between two EMAs, trend momentumYesWhipsaws in sideways markets
    Moving AverageThe trend itselfYesLags turns; no cycle information

    The pairing that works is intuitive: use the DPO to know when a turn is roughly due (timing), and use RSI or a price structure break to confirm that it has actually turned (trigger). Using the DPO alone as a buy or sell signal is the most common mistake, because its displaced, trend-removed nature was never meant to fire live orders.

    Best Settings for Nifty, Bank Nifty and Liquid Stocks

    There is no universal number, but there are sensible starting points. For index swing work on Nifty and Bank Nifty daily charts, a 20-period DPO captures the roughly two-week cycle that index traders watch. For slower, large-cap names like HDFC Bank or TCS, some traders lengthen to 30 to 40 periods to match calmer swings. For fast-moving midcaps, shortening to 10 to 14 periods can fit a tighter cycle, at the cost of more noise.

    • Nifty / Bank Nifty daily: start at 20. Cycle highlighted is about 10 sessions.
    • Large-cap, low-beta stocks (HDFC Bank, TCS, Infosys): 30 to 40 to match smoother swings.
    • Volatile midcaps: 10 to 14, but expect more false wiggles.
    • Intraday on Bank Nifty 15-minute: a 20-period DPO maps the intraday cycle, but only in genuinely range-bound sessions.
    Match the period to the cycle, not to a habit

    Before fixing a number, scroll back and eyeball the typical days between obvious swing lows on that specific instrument. Set N to about twice that count. A 20-period DPO is a default, not a law.

    A Trade Idea in Rupees, With Costs and Tax

    Say the DPO timing suggests Nifty is near a cyclical low and you want a defined-risk long. This is an illustrative example, not advice, and nothing here guarantees a profit. Assume Nifty spot near 24,000 and you buy one lot of an at-the-money weekly call, the 24,000 CE, at a premium of Rs 120. The Nifty F&O lot size is 65.

    • Premium outlay: 120 x 65 = Rs 7,800 (this is also your maximum loss if the option expires worthless).
    • Suppose the cyclical bounce plays out and you exit the call at Rs 165.
    • Gross gain per unit: 165 minus 120 = Rs 45. Across 65 units: 45 x 65 = Rs 2,925 gross.
    • Costs are modest but real: brokerage (often a flat Rs 20 per order, so about Rs 40 for buy plus sell), STT on options is 0.15 percent on the sell-side premium (0.0015 x 165 x 65 = about Rs 16.1), plus exchange transaction charges, GST at 18 percent on brokerage and transaction charges, SEBI fees and stamp duty. Round total costs to roughly Rs 90 to Rs 110 for this small ticket.
    • Net profit after costs: roughly Rs 2,925 minus about Rs 100 = about Rs 2,825.

    On tax: this is an options (F&O) trade, so the profit is treated as business income and taxed at your applicable slab rate, not at the 20 percent short-term capital gains rate that applies to delivery equity. There is no separate STCG or LTCG treatment for F&O. If your slab is 30 percent, the tax on this roughly Rs 3,275 net gain is about Rs 982, leaving you near Rs 2,293. Maintain proper books, because F&O turnover and profit must be reported as business income and may attract audit thresholds. Always confirm current STT, charges and rules on the NSE and your broker before trading, as they change.

    Where the DPO Fails, and How to Avoid the Trap

    The DPO has a hard structural limitation: it assumes prices oscillate around a stable trend. When a stock or index enters a strong directional move, like Nifty during a sustained rally or a stock gapping on results, there is no clean cycle to detect, and the DPO will throw off swings that lead you straight into the trend. It also ignores volume entirely, so a low-conviction wobble and a high-conviction breakout look identical to it.

    • Do not trade DPO turns in a strong trend; first confirm the market is range-bound (for example, price chopping inside a 20-day range).
    • Never act on the last few DPO bars near the right edge, they are displaced and incomplete.
    • Add a volume or RSI filter so you are not buying a cyclical dip into a genuine breakdown.
    • On expiry days and around major events (RBI policy, Budget, big results), short-cycle readings get distorted; widen your filters or stand aside.
    One-line risk rule

    If you cannot draw a clear horizontal range on the chart, the DPO is the wrong tool for that moment. It rewards patience in sideways markets and punishes use in trends.

    Putting It Together: A Practical Checklist

    A repeatable routine keeps you from misusing the indicator. The DPO sets the timing; something non-displaced confirms the entry; risk and tax are planned before you click buy.

    • Confirm the instrument is range-bound on the timeframe you trade.
    • Set N to roughly twice the observed swing spacing (20 is the default for Nifty daily).
    • Measure the typical peak-to-peak days from past DPO swings to anticipate the next turn.
    • Wait for a non-displaced trigger (price break, RSI cross) before entering.
    • Size the position so the worst case is an amount you can lose; for options, premium paid is your max loss.
    • Remember F&O gains are business income at slab, not STCG; account for STT, brokerage and GST in your target.

    Sources and Further Reading

    For authoritative data and further reading on this topic, refer to Zerodha Varsity, Investopedia and NSE India. Always confirm current rules, rates and contract specifications on the official source before you trade.

    Sources and Further Reading

    For authoritative data and further reading on this topic, refer to Zerodha Varsity, Investopedia and NSE India. Always confirm current rules, rates and contract specifications on the official source before you trade.

    Related Topics

    Detrended Price OscillatorDPOIndian stock marketNSEBSEtechnical analysis

    Related Articles

    OneTradeJournal

    The trading journal built for Indian F&O traders. Track your trades, spot patterns, build discipline.

    • Log one trade a day by hand, on purpose
    • AI mentor finds your repeat mistakes
    • Behavioural analytics catch tilt early
    • Trading calendar with P&L heatmap
    • Pre-trade checklist flags risks
    Start journaling

    Yearly ₹2,499 · No broker credentials