Post-mortemSeries · the honest backtest

The 5 EMA strategy has a real edge. Real costs almost erase it.

9½ years of NIFTY. 15,807 trades. Every signal taken, period-correct costs applied. Here is what survives.

RS
Research desk31 Jul 2026 · 14 min read
Cumulative P&L · 1 lot · 2017 → 2026Gross vs net of costs
0THE COST GAP · ₹69.8L+₹58.2LGROSS−₹11.6LNET2017201820192020202120222023202420252026
Green = gross edge before costs. Red = net after brokerage, STT, exchange fees, GST, stamp duty and modelled slippage. Backtested simulation, not a promise of future performance.

The Power-of-Stocks 5 EMA strategy is not a bad idea. As a fade of over-extension from the 5-period EMA, it has a genuine, statistically visible edge — that green line is real, and it is gross-positive in every one of the ten years we tested. The problem starts the moment you charge it what trading actually costs in India.

We ran the textbook version, mechanically: when a full 5-minute candle sits above the 5 EMA we short the break of its low; below, we buy the break of its high; stop at the signal candle's opposite extreme, target three times risk, flat by 15:15. Every signal taken, no discretionary skips, 2017 to mid-2026. Then we billed every fill at the rates that applied on that date — not today's rates smeared backwards across a decade.

Trades
15,807
Gross P&L
+₹58.2L
Total costs
₹69.8L
Net P&L
−₹11.6L

Where the ₹69.8L went

Brokerage is the line everyone optimises and one of the smallest on the bill. The securities transaction tax is the single biggest — and on this futures-priced version, it and slippage together are two-thirds of the damage. Slippage is the only line no broker will ever discount for you. The full cost stack is here.

Cost line9½ yr totalShare
STT (period-correct, sell-side)₹26.2L38%
Slippage & impact₹23.7L34%
Brokerage + exchange + GST + stamp₹19.9L28%

And we were scrupulous about the tax: STT is charged at the rate that actually applied in each year — 0.01% up to 2023, 0.0125% after, 0.02% from October 2024 — not today's higher rate applied across the whole decade. Doing it the honest way makes our “costs win” headline less dramatic. We'll take the smaller, true number every time.

The edge is real — it's just smaller than the friction

Per trade, the gross edge averages +₹368. Average all-in cost per trade: ₹442. That is the whole story. You are not wrong about the signal; you are 74 rupees short per trade, 15,807 times.

A strategy that needs ₹442 of friction to stay flat is not a strategy. It's a subscription to your broker.

Only three levers change that answer: trade less often, capture more per trade, or pay less to trade. The frequency lever is the one this strategy is fighting — it fires about seven times a day, so a thin per-trade edge is asked to clear a cost hurdle seven times over. A real signal, priced as if execution were free, is the most common failure mode in Indian retail systematic trading — and it's one of the four silent lies.

It dies exactly where everyone says it thrives

The common wisdom about the 5 EMA is “it works in trends, it chops you up in a range.” The data says the opposite. Split all 15,807 trades by the kind of day they happened on and the fade is net-profitable in ranging markets — where it's supposed to fail — and a bloodbath in trends, where fading an over-extension means standing in front of a move that doesn't stop.

The day was…TradesNetResult
Choppy / ranging3,654+₹4.5Lprofitable
Mixed3,378−₹0.2Lbreak-even
Trending8,775−₹15.9Lbleeds out

Here's the quiet killer: the strategy took 55% of its trades in trending conditions — it over-trades the exact regime where its edge is thinnest. Strip the trend trades out and this is a different, smaller, profitable strategy. You can even see it year by year: net-positive in 2020 and 2022, roughly flat in others, deeply red only in trending years. This isn't a strategy that can't work — it's one whose result is decided almost entirely by which regime you trade and how often. The signal was never the problem.

How to reproduce this

Everything below is the config we ran. Paste the equivalent into a strategy and you get these numbers back.

5ema-nifty.yaml
instrument: NIFTY 5-min (index-directional / futures proxy)
signal:    a full candle above the 5 EMA -> short;
           a full candle below -> long
entry:     break of the signal candle's extreme
stop:      the signal candle's opposite extreme
target:    3 x risk  (taught 1:3)
exit:      stop / target / 15:15 square-off
period:    2017-01-01 -> 2026-06-30   (every signal, no skips)
costs:     period-correct  (STT 0.01 -> 0.0125 -> 0.02%,
           brokerage, exchange fees, GST, stamp, ~1pt/side slippage)

Common questions

Does the 5 EMA strategy actually work?

In a 9½-year NIFTY backtest (2017–2026, 15,807 trades, 5-min), the Power-of-Stocks 5 EMA fade had a real gross edge — positive every single year, +₹58.2 lakh gross. After realistic Indian costs (STT, brokerage, GST, slippage) it became a net loss of ~₹11.6 lakh. The setup captures a genuine mean-reversion tendency, but on a raw every-signal basis costs exceed the edge.

Why does the 5 EMA strategy lose money after costs?

It trades ~7×/day; each round-trip pays STT, brokerage, exchange fees, GST and slippage. Over 15,807 trades that totalled ~₹69.8 lakh — about 1.2× the ₹58.2 lakh gross edge, with STT the biggest line item. A gross-profitable setup nets negative because it fires too often for its per-trade edge to clear the cost hurdle.

Does the 5 EMA work better in trending or ranging markets?

Opposite to the common belief. Because it's a fade (bets against over-extension), it was roughly break-even-to-profitable in choppy/ranging conditions and lost most in trends, where fading a move means standing in front of it — and it took most of its trades in trends, over-trading its weakest regime.

Is the 5 EMA strategy profitable in India?

On a raw mechanical basis over 2017–2026, no — a net loss after real costs, despite being gross-positive every year; break-even in chop, losing in trends. The honest lesson: in India, costs, regime and frequency decide the outcome as much as the entry rule. Only a real-cost backtest of a specific, more selective version tells you if it survives.

The honest frame

Investment in securities market are subject to market risks. Read all the related documents carefully before investing.

Backtested results are hypothetical, do not represent actual trading, and are not indicative of future results. This article is educational and is not investment advice or a recommendation; Algoshastra is a strategy-building and testing tool, not a registered investment adviser or research analyst. Past or backtested performance does not guarantee future returns.

Backtest performance does not guarantee future returns.All trading involves capital loss risk.algoshastra is a strategy-verification platform, not a SEBI-registered adviser or broker.You are responsible for all trades placed on your broker account.Past performance is for educational reference only.Backtest performance does not guarantee future returns.All trading involves capital loss risk.algoshastra is a strategy-verification platform, not a SEBI-registered adviser or broker.You are responsible for all trades placed on your broker account.Past performance is for educational reference only.