Skip to content

    Double Exponential Moving Average (DEMA) for Indian Markets

    Quick answer

    Learn the Double Exponential Moving Average (DEMA) with a real TCS worked example, correct formula, best Nifty settings and an options trade with costs.

    19 June 2026
    16 min read
    3,043 words

    Key Takeaways

    • 1.The Double Exponential Moving Average (DEMA) reduces lag using the formula DEMA = (2 times EMA1) minus EMA2, where EMA2 is the EMA of EMA1.
    • 2.DEMA is not two EMAs averaged together. The subtraction step is what removes lag, and getting that step wrong gives meaningless numbers.
    • 3.In the worked TCS example below, a 5 period DEMA sits about 36 points closer to the live price than a plain EMA on the same data, which is the whole point of the indicator.
    • 4.For Indian intraday traders, 9 to 21 period DEMA on Nifty and Bank Nifty is common. Longer 50 to 200 period DEMA suits positional swing trades.
    • 5.Faster signals mean more whipsaws in sideways markets, so confirm DEMA crossovers with volume, RSI, or VWAP before risking capital.

    What the Double Exponential Moving Average Actually Is

    The Double Exponential Moving Average, or DEMA, was created by Patrick Mulloy in 1994 and published in Technical Analysis of Stocks and Commodities. Its single job is to track price with less delay than a normal moving average. Every moving average is a smoothing tool, and smoothing always introduces lag, which is the gap between when price actually turns and when the line on your chart turns. In a fast Indian market session, where Nifty can move 100 points in twenty minutes around an RBI policy or a US inflation print, that lag can be the difference between catching a move and chasing it.

    The name causes a common misunderstanding. DEMA does not mean you simply run an EMA twice and use the result. Running an EMA of an EMA actually makes the line slower, not faster, because you are smoothing already smoothed data. Mulloy's insight was to take that double smoothed line and subtract it from twice the first EMA. That subtraction cancels out most of the lag while keeping the smoothness. If you skip or mangle the subtraction, your numbers will be wrong, which is exactly the trap many tutorials fall into.

    DEMA is a price overlay, meaning it is plotted directly on top of the candles in the same units as price, just like a simple or exponential moving average. On an NSE chart of Reliance or HDFC Bank you read it the same way. Price above the DEMA line leans bullish, price below leans bearish, and the slope of the line tells you the strength and direction of the current trend.

    The DEMA Formula, Explained Step by Step

    There are three pieces. First, the smoothing factor, written as k, which depends on the period N you choose. The formula is k = 2 divided by (N plus 1). For a 5 period DEMA, k equals 2 divided by 6, which is 0.3333. A bigger N gives a smaller k and a slower, smoother line. A smaller N gives a larger k and a faster, twitchier line.

    • Compute EMA1, the exponential moving average of the closing price. Each new value is: previous EMA1 plus k times (today close minus previous EMA1). Seed the very first value with the first close.
    • Compute EMA2, the exponential moving average of EMA1. Same formula, but you feed in the EMA1 series instead of price. Seed EMA2 with the first EMA1 value.
    • Apply the final formula: DEMA = (2 times EMA1) minus EMA2. The 2 times EMA1 part keeps the line close to price, and subtracting EMA2 strips out the lag that the smoothing added.

    Notice the logic. If price is rising steadily, EMA1 lags behind price and EMA2 lags even further behind EMA1. The gap (EMA1 minus EMA2) measures how much lag has built up. Adding that same gap back on top of EMA1, which is what 2 times EMA1 minus EMA2 does, pushes the line forward to roughly where price actually is. That is the entire trick.

    A common mistake to avoid

    DEMA is not (EMA1 plus EMA2) divided by 2, and it is not just EMA2 on its own. Both of those are slower than a plain EMA, the opposite of what DEMA is for. If your worked numbers do not end up closer to live price than a single EMA, your formula is wrong.

    A Fully Worked Example on TCS, With Real Math

    Let us compute a 5 period DEMA on a realistic series of TCS daily closing prices on the NSE. The closes used are illustrative but plausible for TCS: 3850, 3872, 3905, 3888, 3940, 3962 and 3995. With N equal to 5, the smoothing factor k is 2 divided by 6, which is 0.3333. Every number in the table below is calculated with the exact formulas above, so you can reproduce them yourself in a spreadsheet.

    DayTCS Close (Rs)EMA1EMA2DEMA = 2 x EMA1 - EMA2
    138503850.003850.003850.00
    238723857.333852.443862.22
    339053873.223859.373887.07
    438883878.153865.633890.67
    539403898.773876.673920.86
    639623919.843891.063948.62
    739953944.903909.013980.78

    Look at day 7. The TCS close is 3995. The plain EMA1 has only crawled up to 3944.90, lagging the price by about 50 points. The DEMA, however, sits at 3980.78, lagging by under 15 points. DEMA is therefore roughly 36 points closer to the live price than the ordinary EMA on the identical data. In a strong uptrend that tighter tracking means an earlier exit signal when price finally rolls over, and an earlier re entry when it turns back up.

    This is the corrected, honest version of a DEMA example. Note how EMA1 and EMA2 both trail price, while their combination through the formula leaps forward. If you ever see a tutorial where the DEMA value lands between EMA1 and EMA2, or below both of them during an uptrend, that example is wrong and you should not trust the rest of it.

    How to Read DEMA on an Indian Chart

    On a Nifty or stock chart, DEMA is read like any moving average but with sharper turns. When candles close above a rising DEMA line, the path of least resistance is up. When candles close below a falling DEMA line, momentum is down. Because DEMA hugs price tightly, the slope of the line flips faster than an SMA or EMA, which is useful in a trend but noisy in a range.

    Many Indian intraday traders run two DEMAs together, for example a fast 9 period and a slower 21 period on a 5 minute Bank Nifty chart. A crossover of the fast DEMA above the slow DEMA is a long bias, and the reverse is a short bias. Because both lines react quickly, the crossover fires earlier than the same setup built from EMAs, giving you more time inside the move but also more false starts when Bank Nifty is chopping in a 150 point box.

    • Price above a rising DEMA: trend up, look for pullback buys.
    • Price below a falling DEMA: trend down, look for pullback sells.
    • DEMA flat and price crossing it repeatedly: a range, stand aside or trade the edges, not the crossovers.
    • Steepening DEMA slope: momentum is accelerating, trail your stop instead of taking a fixed target too early.

    Best DEMA Settings for Nifty, Bank Nifty and Stocks

    There is no single perfect setting, but Indian instruments have practical ranges that traders gravitate towards. The right number depends on your timeframe and on how volatile the instrument is. Bank Nifty moves more than Nifty, and individual stocks vary widely, so a setting that works on TCS may be too slow for a high beta name like a PSU bank stock.

    Trading styleTimeframeTypical DEMA periodBest suited to
    Scalping1 to 3 min9Bank Nifty, Nifty index options
    Intraday momentum5 to 15 min9 and 21 pairNifty, Bank Nifty, liquid F&O stocks
    Swing1 hour to daily21 to 50Reliance, HDFC Bank, TCS, Infosys
    PositionalDaily to weekly100 to 200Index trend, large cap delivery

    A practical rule: the faster the timeframe, the shorter the period. Scalpers on Bank Nifty options often use a single 9 period DEMA as a dynamic line that price respects intraday. Swing traders holding HDFC Bank for a few days lean on a 21 or 50 period DEMA on the hourly or daily chart to stay with the trend and ignore the intraday noise. Always back test on the specific instrument and timeframe you trade, because the same setting behaves very differently on Nifty versus a thin midcap.

    A DEMA Crossover Trade on Nifty Options, With Costs

    Here is an illustrative end to end example so you see the rupees, not just theory. Suppose on a 5 minute Nifty chart the 9 period DEMA crosses above the 21 period DEMA at 10:15 am, with price above both lines and rising volume, signalling a long. Rather than buy futures, the trader buys 2 lots of a Nifty weekly at the money Call. The Nifty lot size is 65, so 2 lots is 150 quantity. Entry premium is Rs 82.

    Nifty runs up through the session. The fast DEMA stays above the slow DEMA, keeping the trader in. Near 2:40 pm the 9 period DEMA curls down and crosses back below the 21 period DEMA, the exit signal. The Call is sold at Rs 134. The gross profit is (134 minus 82) times 150, which is Rs 7,800. Now the costs, which are illustrative and based on a typical discount broker and current charge structure.

    ItemBasisAmount (Rs)
    Gross P&L(134 - 82) x 1507,800.00
    STT0.15% of sell premium (134 x 150)30.15
    BrokerageFlat Rs 20 x 2 orders40.00
    Exchange transaction chargeapprox 0.035% of both side premium turnover11.34
    SEBI charge0.0001% of turnover0.03
    Stamp duty0.003% of buy premium0.37
    GST18% on brokerage, exchange and SEBI charges9.25
    Total costssum of the above91.24
    Net P&Lgross minus total costs7,708.76

    So the net profit is about Rs 7,709 on this single illustrative trade. The DEMA crossover did two jobs: it got the trader in earlier than an EMA crossover would have, and it flagged the exit before price gave back the gains. These figures are illustrative, costs change over time, and options can just as easily expire worthless. Nobody can promise returns, and you must verify current STT and exchange charges on the NSE and your broker before trading.

    Tax reminder for F&O traders

    Profit from Nifty and Bank Nifty options is treated as business income in India, not capital gains. It is added to your total income and taxed at your slab rate, and you can deduct genuine trading expenses. Equity delivery is different: short term gains are taxed at 20% and long term gains above Rs 1.25 lakh at 12.5%. Keep a clean trade log so your filing is accurate.

    DEMA Versus SMA, EMA and TEMA

    Choosing a moving average is a trade off between smoothness and speed. The Simple Moving Average treats every candle equally and is the slowest. The Exponential Moving Average weights recent candles more and is faster. DEMA is faster still. The Triple Exponential Moving Average, or TEMA, applies the same lag cancelling idea one more time and is the most aggressive of the four.

    IndicatorLagSmoothnessFalse signals in a rangeGood for
    SMAHighestHighestFewestSlow positional trends
    EMAMediumHighModerateGeneral trend following
    DEMALowMediumMoreActive intraday and swing
    TEMALowestLowerMostFast scalping, needs filters

    The pattern is clear: every step toward less lag costs you some smoothness and adds whipsaws when price is going sideways. DEMA sits in a useful middle ground for active Indian traders. It is meaningfully faster than an EMA, which matters on a 5 minute Nifty chart, but it is not as jumpy as TEMA. If you find DEMA too noisy, lengthen the period or switch to an EMA. If you find it too slow for scalping, that is where TEMA earns its place, provided you add a filter.

    Combining DEMA With Confirmation Tools

    A fast indicator used alone will hand you plenty of false signals, so confirmation is not optional. The goal is to make sure a DEMA crossover or break only counts as a trade when a second, independent piece of evidence agrees. This filters out the chop that DEMA is most vulnerable to during the lunchtime lull on Indian indices, roughly 11:30 am to 1:30 pm, when ranges tighten.

    • Volume: take a DEMA crossover only when it comes with a clear pickup in volume, which shows real participation rather than a thin drift.
    • RSI: pair a bullish DEMA cross with the RSI holding above 50, and a bearish cross with RSI below 50, to confirm momentum agrees with the line.
    • VWAP: for intraday Nifty and Bank Nifty, only take long DEMA signals above the day VWAP and short signals below it, since institutions anchor to VWAP.
    • ATR: use the Average True Range to size stops, placing them beyond normal noise so a single volatile candle does not knock you out of a valid trade.

    A simple, robust intraday template for Bank Nifty: 9 and 21 period DEMA crossover, in the direction of VWAP, with above average volume on the signal candle, and a stop sized using 1.5 times the current ATR. This will not catch every move, but it removes most of the low quality signals that DEMA alone produces in a range.

    Limitations, Whipsaws and Risk Control

    DEMA's strength is also its weakness. The same responsiveness that catches trends early makes it fire repeatedly in sideways markets, generating losing trade after losing trade as price oscillates around a flat line. Indian indices spend a large share of any month going nowhere, so a DEMA strategy with no range filter can bleed capital through small repeated losses and brokerage even when no single loss is large.

    • Always define your stop loss before entering, ideally below the recent swing low for longs or above the swing high for shorts, not at an arbitrary rupee value.
    • Risk a fixed small percentage of capital per trade, commonly 1% to 2%, so a string of whipsaws cannot do serious damage.
    • Avoid taking DEMA signals in obviously rangebound conditions, when the line is flat and price keeps crossing it.
    • Account for costs in your edge. On options especially, frequent DEMA signals mean frequent STT, brokerage and GST that quietly eat into a thin strategy.

    Treat DEMA as a timing and trend tool inside a complete plan, never as a standalone money machine. The indicator tells you direction and momentum. Your position sizing, stop placement and the decision to stand aside in a range are what actually protect your account. A journal that records every DEMA trade, its setup and its outcome, will show you quickly whether your settings genuinely have an edge on the instruments you trade.

    DEMA in Algorithmic and Systematic Trading

    Because DEMA is a precise mathematical formula, it slots neatly into automated and rule based systems, which is why it appears in many Indian algo strategies built on broker APIs. A coded system removes the hesitation and the revenge trading that hurt manual traders, executing the same DEMA rule the same way every time. The catch is that an algo will also execute a flawed rule perfectly, multiplying small mistakes across hundreds of trades.

    If you systematise a DEMA strategy, back test it honestly on several years of NSE data, including bad years, and include realistic costs such as STT, brokerage, slippage and the bid ask spread on the options you trade. A strategy that looks brilliant on a cost free back test often turns into a loss once real Indian transaction charges are subtracted. Also confirm that any automated trading you run complies with current SEBI and exchange rules for retail algos, since the framework around retail algorithmic trading in India continues to evolve.

    Sources and Further Reading

    For authoritative data and further reading, refer to Zerodha Varsity, Investopedia and NSE India. You can also pair DEMA with the Relative Strength Index and size stops using the Average True Range. Always confirm current rules, tax 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

    Double Exponential Moving AverageDEMAIndian stock markettechnical indicatorsNSEBSENiftyBank Nifty

    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