OPEN-SOURCE SCRIPT
9 & 15 EMA Strategy [Trade Room]

OVERVIEW
This indicator combines a fast/slow EMA crossover (default 9 and 15) with a
trend-slope filter and price-action candle confirmation to generate long and
short signals, along with automatically calculated take-profit and stop-loss
levels based on a user-defined risk:reward ratio.
The EMA 9/15 crossover is a long-standing, widely taught trend-following
concept in retail trading education. This script is my own original
implementation of that concept, built with additional filters to reduce
false signals in choppy conditions.
HOW IT WORKS
1. Trend filter: the script checks whether the fast EMA is above or below
the slow EMA to establish bullish or bearish bias.
2. Slope filter (optional): both EMAs must be sloping steeply enough,
measured as percentage change over a short lookback, to confirm the
move has real momentum rather than chopping sideways. This is adjustable
so it can be tuned per instrument and timeframe.
3. Price action filter (optional): a signal only fires when price pulls
back to the fast EMA and the resulting candle matches one of three
patterns — pin bar, engulfing, or an above-average range "big bar" —
in the direction of the trend.
4. TP/SL: stop-loss is placed at the signal candle's high/low, and take-
profit is calculated as a multiple of that risk distance, set by the
Risk:Reward input (default 1:2).
WHY IT'S USEFUL
Most EMA crossover scripts only plot crossovers, leaving the trader to
manually judge trend strength and risk levels. This script adds an
objective slope threshold and candle-pattern confirmation layer on top of
the crossover, and automatically plots calculated TP/SL levels so risk
is defined before entry, not after.
SETTINGS
- Fast/Slow EMA length — fully adjustable, not fixed to 9/15
- Slope filter toggle and threshold — tune sensitivity per asset/timeframe
- Candle pattern filter toggle
- Risk:Reward ratio for TP calculation
- Independent show/hide toggles for EMAs, labels, TP, and SL
- Alert conditions for both signal types
LIMITATIONS
Like any trend-following tool, this indicator will produce false signals
in ranging or low-volatility conditions. The slope filter is designed to
reduce — not eliminate — this. No indicator predicts price; this is a
decision-support tool, not financial advice, and past signal behavior is
not indicative of future results. Always backtest on your specific
instrument and timeframe and use proper risk management.
This indicator combines a fast/slow EMA crossover (default 9 and 15) with a
trend-slope filter and price-action candle confirmation to generate long and
short signals, along with automatically calculated take-profit and stop-loss
levels based on a user-defined risk:reward ratio.
The EMA 9/15 crossover is a long-standing, widely taught trend-following
concept in retail trading education. This script is my own original
implementation of that concept, built with additional filters to reduce
false signals in choppy conditions.
HOW IT WORKS
1. Trend filter: the script checks whether the fast EMA is above or below
the slow EMA to establish bullish or bearish bias.
2. Slope filter (optional): both EMAs must be sloping steeply enough,
measured as percentage change over a short lookback, to confirm the
move has real momentum rather than chopping sideways. This is adjustable
so it can be tuned per instrument and timeframe.
3. Price action filter (optional): a signal only fires when price pulls
back to the fast EMA and the resulting candle matches one of three
patterns — pin bar, engulfing, or an above-average range "big bar" —
in the direction of the trend.
4. TP/SL: stop-loss is placed at the signal candle's high/low, and take-
profit is calculated as a multiple of that risk distance, set by the
Risk:Reward input (default 1:2).
WHY IT'S USEFUL
Most EMA crossover scripts only plot crossovers, leaving the trader to
manually judge trend strength and risk levels. This script adds an
objective slope threshold and candle-pattern confirmation layer on top of
the crossover, and automatically plots calculated TP/SL levels so risk
is defined before entry, not after.
SETTINGS
- Fast/Slow EMA length — fully adjustable, not fixed to 9/15
- Slope filter toggle and threshold — tune sensitivity per asset/timeframe
- Candle pattern filter toggle
- Risk:Reward ratio for TP calculation
- Independent show/hide toggles for EMAs, labels, TP, and SL
- Alert conditions for both signal types
LIMITATIONS
Like any trend-following tool, this indicator will produce false signals
in ranging or low-volatility conditions. The slope filter is designed to
reduce — not eliminate — this. No indicator predicts price; this is a
decision-support tool, not financial advice, and past signal behavior is
not indicative of future results. Always backtest on your specific
instrument and timeframe and use proper risk management.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.
Script open-source
Nello spirito di TradingView, l'autore di questo script lo ha reso open source, in modo che i trader possano esaminarne e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricordiamo che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni e le pubblicazioni non sono intese come, e non costituiscono, consulenza o raccomandazioni finanziarie, di investimento, di trading o di altro tipo fornite o approvate da TradingView. Per ulteriori informazioni, consultare i Termini di utilizzo.