How to Set EMA Crossover Alerts on TradingView
Set an alert between two EMA plots, confirm the crossing direction and timeframe, and distinguish an example EMA pair from a tested trading strategy.
Setup Steps
Add and identify the two averages
Add two exponential moving averages and set their lengths and price sources. For an illustrative setup, use 9 and 21 with the same source and timeframe. Label the intended fast and slow inputs in your notes; these values are examples, not the best settings for a market.
Compare the two plotted series
Open Create Alert. Select the fast EMA plot, a Crossing up operator and the slow EMA plot as the other operand where offered. Use Crossing down for the reverse event. Do not accidentally compare an EMA with a fixed price or the symbol’s close. If a custom variant does not expose both plots, use a script with a documented crossover condition.
Distinguish event from continuing state
A crossover occurs when relative ordering changes. Fast EMA remaining above slow EMA is a state that can persist for many bars. Decide which you need before choosing the condition. The term golden cross usually refers to a longer-term 50/200 moving-average comparison; name short-period alerts by their actual lengths.
Save the alert context
Choose the frequency, expiry and notification method in your account. For a rule defined on completed candles, select Once Per Bar Close where available. Record the symbol, timeframe and inputs. Recreate the alert after changing the script or its inputs; the running alert retains its saved configuration.
Verify delivery on new market data
Treat chart inspection and delivery as separate checks. Bar Replay can help inspect historical plots, but server alerts continue using live data. Check a new event against the alert log, then check the chosen notification channel. This is a test procedure, not a claim that delivery or investment performance has been tested here.
Alert Conditions Reference
Conditions to define and verify for the selected indicator.
| Condition | Signal | Notes |
|---|---|---|
| Fast EMA crosses above slow EMA | The faster average moved above the slower | A lagging change in relative averages, not a guaranteed upward move. |
| Fast EMA crosses below slow EMA | The faster average moved below the slower | The rule still needs an exit, position size and cost assumptions before it becomes a strategy. |
| Fast EMA remains above slow EMA | Positive ordering state | Use a greater-than rule for a state; it is not interchangeable with a single cross event. |
| Three-EMA ordering | A separately defined composite condition | Specify whether all three must cross on one bar or merely finish in a chosen order. |
Parameters to record and evaluate
Examples describe the configuration, not validated trading settings.
| Parameter | Starting value or requirement | Description |
|---|---|---|
| Fast length | 9, example | Choose a length before evaluating later data; do not optimize by repeatedly selecting the best recent result. |
| Slow length | 21, example | Keep it distinct from the fast length and document the pair in the alert name. |
| Source | Same source for both, initially | HLC3 and OHLC4 are alternative price averages; neither guarantees earlier or more reliable signals. |
| Timeframe | Explicitly selected | An event on a one-minute chart is not the same calculation as a five-minute crossover. |
FAQ
Alert Setup FAQ
How do I configure a 50/200 EMA alert?
Why can an alert disagree with the current chart?
Can a crossover reverse before close?
What is the best EMA pair for scalping?
When is custom code useful?
Need a custom alert rule?
Describe the condition in Pineify’s coding agent, then review the generated Pine Script and test its timing and delivery in TradingView.
Explore Pine Script coding