QuantsappFaster in the app: live data, alerts, tradingOpen
Log inStart free
Futures · technicalIntradayNIFTYlow complexity

Buffered 9/21 EMA cross

The 9/21 EMA crossover is one of the simplest trend signals, but on intraday charts it flickers back and forth whenever the market goes sideways. This version only counts a cross once the gap between the two EMAs is wider than a quarter of the ATR, and only in the direction of the 200-bar SMA. It trades NIFTY futures on 15-minute bars between 09:45 and 13:30 and is flat by 14:30.
Trades NIFTY futures on a 15-minute EMA 9/21 cross that must clear a quarter-ATR buffer and agree with the 200-bar SMA, with a 1.5 ATR stop and 14:30 exit.
Market viewEither direction (follows the move)
TradesNIFTY near-month futures, intraday
RiskOpen-ended (loss not capped by the structure)
CapitalFutures margin
SuitsBeginner
Trades a month5.4
Typical hold3.0 hours
Profitable months9 of 12
Longest losing run5 trades
Made money inTrend days that close near the high or lowWeekly expiry days (Tuesday)India VIX above 14.5
Lost money inQuiet sessions (range under 0.75%)Calm markets with India VIX below 11.5
Default settings
Symbol
Bar minutes
Fast
Slow
ATR period
Gamma
Trend SMA
Stop ATR
Entry from
Last entry
Exit time
Lots
Backtest this strategy →Change any setting, pick your own period and run it in the Quantsapp web app. Backtesting is part of the Max plan. Pro+ members can use it now as a free trial.
1

How it trades

What it trades
Universe
NIFTY Intraday · 1 Oct 25 → 30 Sep 26
Enters
15-min close 09:45-13:30: EMA 9/21 gap beyond 0.25 ATR, with the 200-bar SMA
Legs
BUY FUT · Near month · Current month · 1 lotSELL FUT · Near month · Current month · 1 lot
Exits
stop 1.5 x the signal bar's ATR from entrysignal EMA 9 closes back through EMA 21time 14:30
Re-entry
Next buffered cross, one trade at a time
Bars
BAR_MINUTES bars of the rolled near-month future, anchored at 09:15, continuous across sessions. EMA FAST and EMA SLOW of the closes, ATR(ATR_PERIOD) (Wilder) and SMA(TREND_SMA) of the closes.
Entry
a bar closing between ENTRY_FROM and LAST_ENTRY where EMA FAST - EMA SLOW rises above +GAMMA x ATR (it was not above the buffer at the previous bar) and the close is above the SMA -> buy LOTS at the next tick. Mirror: the spread falls below -GAMMA x ATR with the close below the SMA -> sell.
Stop
STOP_ATR x the signal bar's ATR from the entry price (points), at market once crossed.
Exit
a bar closing with EMA FAST back through EMA SLOW (no buffer) -> out at the next tick; anything open at EXIT_TIME is squared off. One trade at a time; a new one needs a new buffered cross.
2

Results

PRE-BUILT · DEFAULTS
NIFTY · 2025-10-01 → 2026-09-30 · 65 trades · before costs
Net P&L+₹41,875
Win rate52%
Max drawdown−₹24,550
Avg per trade+₹644
Profit factor1.37
Worst trade−₹8,801
3

Where it made and lost money

In this test the buffered crossover earned its money on trend days: ₹90,086 over 23 trades with a 74% win rate, more than twice the year's total. When the session keeps moving after the cross, the position simply rides to 14:30. Quiet sessions lost ₹39,026 over 30 trades, because a cross in a narrow range drifts back and the trade either hits the 1.5 ATR stop or closes flat at 14:30. Expiry days made ₹28,002 over 13 trades, and nervous days after India VIX closed above 14.5 made ₹23,023, while calm days below 11.5 barely broke even.

Kind of session on the entry day
Quiet session (range under 0.75%)−₹39,02630 trades40% won
Trend day (closed near the high or low)+₹90,08623 trades74% won
Choppy day (wide range, closed mid-range)−₹9,18412 trades42% won
Session direction on the entry day
NIFTY closed above its open−₹6,01530 trades43% won
NIFTY closed below its open+₹47,89135 trades60% won
Day of the week
Monday+₹2,55911 trades45% won
Tuesday+₹28,00213 trades77% won
Wednesday+₹16,07815 trades60% won
Thursday−₹10,6129 trades33% won
Friday+₹19,72715 trades47% won
How the entry day opened
Gap up of 0.4% or more+₹14,2308 trades62% won
Flat open+₹30,14849 trades51% won
Gap down of 0.4% or more−₹2,5028 trades50% won
India VIX the evening before
VIX below 11.5 (calm)+₹1,43819 trades42% won
VIX 11.5-14.5 (normal)+₹17,41433 trades55% won
VIX above 14.5 (nervous)+₹23,02313 trades62% won
Expiry day (NIFTY weekly)
Expiry day+₹28,00213 trades77% won
Other days+₹13,87452 trades46% won
Trend going in
Uptrend (NIFTY above its 20-day average)+₹18,25033 trades55% won
Downtrend (NIFTY below its 20-day average)+₹23,62632 trades50% won
The same trades, split by the market conditions around each entry, before costs.
4

About this strategy

  1. Build 15-minute bars of the near-month NIFTY future, joined across sessions and adjusted for the jump at each monthly roll. Compute EMA 9, EMA 21, ATR(14) and the 200-bar SMA.
  2. Long signal: a bar closing between 09:45 and 13:30 where EMA 9 minus EMA 21 rises above 0.25 times ATR (it was not above that buffer on the previous bar) and the close is above the SMA. Buy one lot at the next tick.
  3. Short signal: the mirror, with the gap falling below minus 0.25 ATR and the close below the SMA.
  4. Stop at 1.5 times the signal bar's ATR from the entry price.
  5. Exit when EMA 9 closes back through EMA 21, or at 14:30, whichever comes first.
  6. One trade at a time; a new trade needs a fresh buffered cross.

Why traders use it

Requiring the EMAs to separate by a fraction of the ATR filters out the tiny crosses that happen in quiet, directionless trade, while still adapting to the day's volatility. The 200-bar SMA keeps trades on the side of the larger trend, and the restricted entry window avoids both the opening noise and the late-afternoon lull. The ATR-based stop scales with conditions. It is a straightforward refinement of a crossover that many traders already use.

Works best whenIn this test, trend days that closed near their high or low (₹90,086 over 23 trades), weekly expiry days, sessions that ended below their open and nervous markets after India VIX closed above 14.5.
Struggles whenQuiet sessions with a range under 0.75%, which lost ₹39,026 over 30 trades as crosses faded without follow-through, calm markets after India VIX closed below 11.5, and choppy days, though the choppy sample was smaller.

The year in plain words

On NIFTY futures from 1 Oct 2025 to 30 Sep 2026 with default settings, the strategy took 65 trades, won 52% and made ₹41,875 before costs (profit factor 1.37). After ₹20 per order and bid-ask slippage it still made ₹32,390. In this run every trade ended either at the 14:30 square-off (44) or at the 1.5 ATR stop (21). Nine of twelve months were positive, with March the best at ₹18,174; August lost ₹15,203. Wins averaged about ₹4,588 against losses of ₹3,681, and the maximum drawdown was ₹24,550 before costs. The modest trade count kept costs manageable.

What the settings do

Bar minutesThe bar length for all indicators. Shorter bars give more and earlier signals with more noise.FastThe fast EMA length in the crossover.SlowThe slow EMA length in the crossover.ATR periodThe number of bars in the ATR used for the buffer and the stop.GammaHow wide the EMA gap must be, as a multiple of ATR, from 0 to 1. Zero trades every plain cross; higher values wait for a clearer separation.Trend SMAThe length of the moving average used as the trend filter. Longs need the close above it, shorts below.Stop ATRThe stop distance as a multiple of the signal bar's ATR. A wider stop survives more noise but loses more when hit.Entry fromSignal bars closing before this time are ignored.Last entrySignal bars closing after this time are ignored.Exit timeAny open position is squared off at this time.

Risks

  • A 1.5 ATR stop on a full NIFTY futures lot can cost several thousand rupees per trade.
  • Profit depended on trend days; quiet days lost steadily and a run of them, as in August, produces a losing month.
  • The crossover is late by design, so part of each move is missed before entry.
  • Futures positions need margin and move point for point with the index.

Who it suits

Intraday futures traders who want a simple, filtered trend signal with few trades and a firm afternoon exit. It requires futures margin and acceptance of losing streaks on quiet days.

5

Questions traders ask

What is the 9 21 EMA crossover strategy?

It buys when the 9-period EMA crosses above the 21-period EMA and sells when it crosses below, treating the cross as a change in short-term trend. This version adds two filters: an ATR-based minimum gap between the EMAs and the direction of the 200-bar moving average.

Is the EMA 9/21 crossover profitable on NIFTY?

In this backtest on 15-minute NIFTY futures from 1 Oct 2025 to 30 Sep 2026 it made ₹41,875 before costs and ₹32,390 after ₹20 per order and bid-ask slippage, with statutory charges excluded. Most of the profit came from trend days. Past results do not guarantee future ones.

What does the ATR buffer do?

It requires the gap between EMA 9 and EMA 21 to be larger than a quarter of the current ATR before a cross counts. On quiet bars the EMAs often cross by tiny amounts and cross back; the buffer ignores those and waits for a meaningful separation.

Why is entry limited to 09:45 to 13:30?

The first half hour is noisy, and signals late in the session have little time to develop before the 14:30 exit. Restricting the window keeps trades to the part of the day where a 15-minute crossover has room to work.

6

Before you rely on it

WATCH OUTan EMA crossover on 15-minute bars gives few, late signals in a 4-hour window; the SMA(200) needs ~8 sessions of bars to warm up (WARMUP_DAYS). Gross of costs.
WHERE THE RULES WERE UNCLEAR · OUR CHOICESThe README gives the rule shape and the session window but no gamma or exits. Per the spec: GAMMA 0.25, 15-minute bars, exit on the plain opposite cross or a 1.5 x ATR stop, square-off at the repo's 14:30. Entries fill at the first tick after the signal bar closes. The source covers NIFTY and BANKNIFTY; NIFTY is the default. The rolled future jumps at each monthly roll. The indicators are computed on a roll-adjusted series: from the session after each expiry the jump (its first tick minus the expiry day's last tick, overnight move included) is taken out. Fills are real futures prices.
Also known as9 21 EMAvolatility buffered EMA crossover
Backtests run on historical NSE data with fills at the last traded price. "Before costs" excludes brokerage, taxes and slippage. Quantsapp is not recommending any strategy; it is just a backtesting utility. Past results are not a promise of future returns.

Log in or sign up

Enter your mobile number. New to Quantsapp? The same OTP creates your free account.

+91

By continuing you agree to the Terms of Use and Privacy Policy.