EMA Crossover Pine Script for Prop Firm Evaluations

The 9/21 EMA crossover is the most widely used trend-entry signal in futures day trading. This Pine Script adds a VWAP direction filter, bar-close confirmation, and prop-firm-compliant risk management to make it evaluation-ready out of the box.

What EMA crossover is — and why it works for prop firm trading

An exponential moving average crossover uses two EMAs of different lengths to flag a shift in short-term momentum. The fast EMA (9-period) reacts quickly to price; the slow EMA (21-period) tracks the broader trend with less noise. When the fast average closes above the slow one, the shift points up — a potential long. When it closes below, the shift points down — a potential short.

The crossover has stayed relevant for decades because it captures something fundamental: the transition from one short-term price regime to another. When the average of the last nine closes overtakes the average of the last twenty-one, near-term direction has genuinely shifted.

For prop firm trading specifically, the crossover carries a structural advantage: it's completely objective. Either the cross happened on bar close or it didn't — no interpretation required. That makes the condition trivial to define in one line of Pine Script, backtest across years of data, and run through TradingView alerts without a judgment call live.

Why EMA crossover is one of the most popular prop firm setups

Walk into any futures trading community and some version of an EMA crossover strategy is already running in the background. That popularity holds up because the logic is simple enough to fully understand, backtestable enough to verify, and pairs naturally with a clean stop.

That stop placement matters. When the fast EMA crosses above the slow one and the script goes long, the natural stop sits a couple of points below the crossover candle's swing low — defined before entry, sized to the account tier, and respected automatically. There's no "let's see where it goes" discretion quietly eating into a daily loss limit.

Faster variants — 3/8 or 5/13, for example — fire too often for an evaluation account: eight or more signals a day means eight or more chances to breach a daily limit on a rough session. The 9/21 pair produces a handful of signals per session on a 5-minute chart, which is closer to the frequency an evaluation account can comfortably absorb.

The 9/21 crossover vs other EMA periods

8/21: marginally faster than 9/21 — usually a one-bar difference on a 5-minute chart — but it produces slightly more crossovers, and with them slightly more exposure. For an evaluation where keeping the daily trade count low matters, 9/21 is the better default.

9/21: the balance point for 5-minute ES and NQ trading — fast enough to catch a momentum shift early, slow enough to filter out most one-bar whipsaws during low-volume consolidation.

20/50: a different tool entirely — a swing or positional signal meant for hourly or daily charts. On a 5-minute chart it lags so far behind price that by the time it fires, the bulk of the move has often already happened. It isn't a good fit for an intraday evaluation with a short completion window.

How the Pine Script implements the 9/21 crossover

The script calculates both EMAs on every bar close and fires entries exclusively on that close — never on an intrabar level. That removes repainting: the crossover visible in the backtest is the same crossover the live alert fires on, at the same bar.

The VWAP direction filter is the single most valuable addition over a raw crossover. Without it, the 9/21 generates a meaningful share of false signals during the choppy midday stretch when price oscillates around VWAP with no real bias. With it active, longs only qualify when price trades above session VWAP at the moment of the cross, and shorts only qualify below it — cutting a large share of counter-trend false starts.

Stop placement is swing-based: the script looks back a configurable number of bars (5 by default) and places the stop below the lowest low (longs) or above the highest high (shorts) in that window, with a maximum-dollar override so an unusually wide bar can't blow past the per-trade risk cap.

Pine Script
//@version=5
strategy("9/21 EMA Crossover — Illustration", overlay=true)

fastLen  = input.int(9, "Fast EMA")
slowLen  = input.int(21, "Slow EMA")
lookback = input.int(5, "Swing Stop Lookback")

fastEMA = ta.ema(close, fastLen)
slowEMA = ta.ema(close, slowLen)
sessVWAP = ta.vwap(hlc3)

longCross  = ta.crossover(fastEMA, slowEMA)
shortCross = ta.crossunder(fastEMA, slowEMA)

longOK  = longCross and close > sessVWAP
shortOK = shortCross and close < sessVWAP

if longOK
    stopLevel = ta.lowest(low, lookback)
    strategy.entry("EMA Long", strategy.long)
    strategy.exit("Long Stop", "EMA Long", stop=stopLevel)
if shortOK
    stopLevel = ta.highest(high, lookback)
    strategy.entry("EMA Short", strategy.short)
    strategy.exit("Short Stop", "EMA Short", stop=stopLevel)

Adding MACD or RSI as a secondary filter

The Pro and Custom plans include optional secondary filters for traders who want additional confirmation beyond the base 9/21 plus VWAP setup, which already performs well on its own.

MACD filter: requires a positive (or rising) MACD histogram for longs and a negative one for shorts, confirming that momentum agrees with the crossover direction rather than fading into it. RSI filter: requires RSI above 45 for longs (not overbought, but leaning upward) and below 55 for shorts, screening out entries after a run that's more likely to consolidate than continue. Both are optional add-ons pre-built into the Custom plan's multi-filter configuration.

Best session times for EMA crossover signals

The New York morning window — roughly 9:30 to 11:30 AM ET — tends to produce the cleanest crossovers. Volume and institutional order flow are both at their strongest, which makes the VWAP filter particularly effective in this stretch.

The 1:30–3:30 PM window can still produce solid signals on trend days but tends toward more false starts on range-bound ones. The session filter is configurable to the morning window only or extended through the afternoon depending on your evaluation timeline.

Best firms and account sizes for EMA crossover

Firm Account Size Why It Fits Recommended Contract
Apex Trader Funding 50k No daily loss limit on the evaluation, so a handful of crossover signals a day — even back-to-back stops — won't trigger a daily breach; the intraday trailing threshold protects capital on winning runs. MES (1–2 contracts)
Topstep 50k $1,000 daily limit. Fixed swing-based stops on MES leave room to absorb several consecutive losses, and the eod trailing drawdown doesn't punish an intraday swing before the close. MES (1 contract)
MyFundedFutures 50k Static drawdown never moves — a series of crossover winners doesn't raise the floor — and the signal frequency easily satisfies the minimum trading-day requirement. MES or MNQ
Tradeify (Growth path) 50k No hard daily limit on the Growth eval; eod trailing drawdown means a few crossover signals a day fit comfortably within the systematic-trading spirit of that path. MES (1–2 contracts)

Performance characteristics

Win rate (VWAP filter on)
Average R:R (winners)
Avg. signals per session
False-crossover reduction from VWAP filter

Backtest figures for this configuration will replace the placeholders above once a verified TradingView Strategy Tester run is complete.

Backtested results, once published, are based on historical market data only and are not a guarantee of future performance. Evaluation outcomes depend on execution quality, spread, and your specific firm's rules at the time you trade.

Get the EMA Crossover Pine Script — From $19/mo

Starter includes the core 9/21 crossover with a fixed stop, an RTH filter, and a daily kill switch. Pro adds the VWAP filter, optional MACD/RSI confirmation, and multi-account webhook support.

Frequently asked questions

What is the 9/21 EMA crossover strategy?
It pairs a fast 9-period exponential moving average with a slower 21-period EMA. When the 9 EMA closes above the 21 EMA, the script signals a long; when it closes below, a short. Our Pine Script adds a session VWAP direction filter to cut false signals and places stops at the recent swing structure.
Why is EMA crossover popular for prop firm evaluations?
It is fully objective — the cross either happened on bar close or it didn't, with no discretion involved. That makes rule-based behavior easy to demonstrate, and the swing-based stop keeps per-trade risk quantifiable and consistent from one signal to the next.
Why use 9 and 21 periods instead of other combinations?
The 9/21 pair balances responsiveness with noise reduction on 5-minute futures charts. Faster pairs like 8/21 fire more often and produce more false positives in chop. Slower pairs like 20/50 are built for hourly or daily charts — on a 5-minute chart they lag so far behind price that entries often land near the end of the move rather than the beginning.
Can I automate the EMA crossover Pine Script on a prop firm account?
Yes. The script fires a TradingView alert on bar close whenever a VWAP-filtered crossover occurs, and that alert routes through an execution bridge like TradersPost to your Tradovate or Rithmic account. All major futures prop firms permit automation on the evaluation — confirm the funded-account policy separately.
What is the difference between Starter and Pro EMA crossover plans?
Starter includes the core 9/21 crossover with bar-close confirmation, a fixed dollar stop, an RTH session filter, and a daily kill switch. Pro adds the VWAP direction filter, configurable EMA periods, an optional MACD or RSI secondary filter, partial profit targets, and multi-account TradersPost webhook payloads.