OPEN-SOURCE SCRIPT
EMA Trend Pro

EMA Trend Pro
OVERVIEW
EMA Trend Pro is a dual moving-average trend tool with built-in confluence filters. It colors the trend, marks momentum shifts when the fast average crosses the slow one, and — unlike a plain moving-average cross — filters those signals through a higher-timeframe trend check and an ATR-based range check to cut down on false signals. A compact info panel keeps the current state visible at a glance.
HOW IT WORKS
The script builds two moving averages from a source of your choice, and you can select the averaging method (EMA, SMA, WMA, RMA, or VWMA):
• Fast MA (default 21) — reacts quickly to recent price.
• Slow MA (default 55) — represents the broader trend.
Their relationship defines the regime:
• Fast above slow → momentum aligned to the upside → bullish (green).
• Fast below slow → momentum aligned to the downside → bearish (red).
A moving average smooths price into a single line; an exponential MA weights recent bars more heavily so it tracks price faster than a simple average. Using two lengths separates short-term momentum (fast) from the prevailing trend (slow), and the point where they cross is a classic signal for a potential shift of control between buyers and sellers.
THE FILTERS (what makes this more than a plain cross)
A raw moving-average cross has two well-known weaknesses: it fires against the larger trend, and it whipsaws when the market is flat. EMA Trend Pro addresses both:
• Higher-timeframe (HTF) filter — the same two averages are also computed on a higher timeframe you choose. Long signals are only allowed when the HTF trend is up, and short signals only when it is down. This keeps you trading with the larger trend instead of against it. The HTF values are read without lookahead, so historical signals do not repaint.
• ATR separation filter — the Average True Range (ATR) measures how much price typically moves per bar. This filter ignores any cross where the two averages are closer together than a chosen multiple of ATR, which removes the low-conviction crosses that happen when the averages are tangled in a tight range.
Both filters are optional and independent, so you can run the tool as a simple cross, a trend-aligned system, or a strict range-aware system.
WHAT IT DRAWS
• Fast MA line, colored by the active trend (green / red).
• Slow MA line as a neutral reference.
• A fill between the two averages, tinted by direction — a wider gap means stronger separation.
• Optional background tint and optional bar coloring for the current regime.
• Triangle markers on the exact bar where a filtered signal occurs (up / down).
INFO PANEL
A small top-right table shows, at a glance:
• Trend — current lower-timeframe direction.
• HTF — the higher-timeframe direction and the timeframe used.
• Signal — LONG, SHORT, or none on the current bar.
HOW TO USE IT
• Trend bias: read green as a long bias and red as a short bias.
• Signals: the up / down triangles mark filtered momentum shifts. With the HTF filter on, they only appear in the direction of the larger trend.
• Reduce noise: enable the ATR separation filter, or raise its multiplier, to keep only stronger crosses.
• Tuning: shorter lengths give faster, more frequent signals; longer lengths give fewer, smoother ones. Try different MA types and a higher timeframe that suits your trading style (for example, a 4H filter for signals taken on lower timeframes).
SETTINGS
• MA type — averaging method (EMA / SMA / WMA / RMA / VWMA).
• Source — price series the averages are built from (default close).
• Fast length / Slow length — the two averages (defaults 21 / 55).
• Higher-timeframe filter + Higher timeframe — enable and choose the HTF trend check.
• Min separation filter + Min separation (× ATR) — enable and set the range filter.
• Trend fill / Trend background / Color bars by trend / Signal markers / Info panel — display toggles.
ALERTS
Four ready-made alerts: filtered Long and Short signals, plus Trend flip up and Trend flip down — so you can be notified on any symbol or timeframe.
NOTES & LIMITATIONS
Moving-average crosses are lagging by nature: they confirm a move after it has begun rather than predicting it. The filters reduce false signals but cannot remove them, and a higher-timeframe filter naturally produces fewer, later entries in exchange for better alignment. This tool is a visual aid for trend direction and momentum shifts — it is not a complete trading system and does not manage risk or position size. Always confirm with your own analysis.
Open-source — feel free to study, use, and build on it.
For research and educational purposes only. This is not financial advice.
OVERVIEW
EMA Trend Pro is a dual moving-average trend tool with built-in confluence filters. It colors the trend, marks momentum shifts when the fast average crosses the slow one, and — unlike a plain moving-average cross — filters those signals through a higher-timeframe trend check and an ATR-based range check to cut down on false signals. A compact info panel keeps the current state visible at a glance.
HOW IT WORKS
The script builds two moving averages from a source of your choice, and you can select the averaging method (EMA, SMA, WMA, RMA, or VWMA):
• Fast MA (default 21) — reacts quickly to recent price.
• Slow MA (default 55) — represents the broader trend.
Their relationship defines the regime:
• Fast above slow → momentum aligned to the upside → bullish (green).
• Fast below slow → momentum aligned to the downside → bearish (red).
A moving average smooths price into a single line; an exponential MA weights recent bars more heavily so it tracks price faster than a simple average. Using two lengths separates short-term momentum (fast) from the prevailing trend (slow), and the point where they cross is a classic signal for a potential shift of control between buyers and sellers.
THE FILTERS (what makes this more than a plain cross)
A raw moving-average cross has two well-known weaknesses: it fires against the larger trend, and it whipsaws when the market is flat. EMA Trend Pro addresses both:
• Higher-timeframe (HTF) filter — the same two averages are also computed on a higher timeframe you choose. Long signals are only allowed when the HTF trend is up, and short signals only when it is down. This keeps you trading with the larger trend instead of against it. The HTF values are read without lookahead, so historical signals do not repaint.
• ATR separation filter — the Average True Range (ATR) measures how much price typically moves per bar. This filter ignores any cross where the two averages are closer together than a chosen multiple of ATR, which removes the low-conviction crosses that happen when the averages are tangled in a tight range.
Both filters are optional and independent, so you can run the tool as a simple cross, a trend-aligned system, or a strict range-aware system.
WHAT IT DRAWS
• Fast MA line, colored by the active trend (green / red).
• Slow MA line as a neutral reference.
• A fill between the two averages, tinted by direction — a wider gap means stronger separation.
• Optional background tint and optional bar coloring for the current regime.
• Triangle markers on the exact bar where a filtered signal occurs (up / down).
INFO PANEL
A small top-right table shows, at a glance:
• Trend — current lower-timeframe direction.
• HTF — the higher-timeframe direction and the timeframe used.
• Signal — LONG, SHORT, or none on the current bar.
HOW TO USE IT
• Trend bias: read green as a long bias and red as a short bias.
• Signals: the up / down triangles mark filtered momentum shifts. With the HTF filter on, they only appear in the direction of the larger trend.
• Reduce noise: enable the ATR separation filter, or raise its multiplier, to keep only stronger crosses.
• Tuning: shorter lengths give faster, more frequent signals; longer lengths give fewer, smoother ones. Try different MA types and a higher timeframe that suits your trading style (for example, a 4H filter for signals taken on lower timeframes).
SETTINGS
• MA type — averaging method (EMA / SMA / WMA / RMA / VWMA).
• Source — price series the averages are built from (default close).
• Fast length / Slow length — the two averages (defaults 21 / 55).
• Higher-timeframe filter + Higher timeframe — enable and choose the HTF trend check.
• Min separation filter + Min separation (× ATR) — enable and set the range filter.
• Trend fill / Trend background / Color bars by trend / Signal markers / Info panel — display toggles.
ALERTS
Four ready-made alerts: filtered Long and Short signals, plus Trend flip up and Trend flip down — so you can be notified on any symbol or timeframe.
NOTES & LIMITATIONS
Moving-average crosses are lagging by nature: they confirm a move after it has begun rather than predicting it. The filters reduce false signals but cannot remove them, and a higher-timeframe filter naturally produces fewer, later entries in exchange for better alignment. This tool is a visual aid for trend direction and momentum shifts — it is not a complete trading system and does not manage risk or position size. Always confirm with your own analysis.
Open-source — feel free to study, use, and build on it.
For research and educational purposes only. This is not financial advice.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.
Скрипт с открытым кодом
В истинном духе TradingView, создатель этого скрипта сделал его открытым исходным кодом, чтобы трейдеры могли проверить и убедиться в его функциональности. Браво автору! Вы можете использовать его бесплатно, но помните, что перепубликация кода подчиняется нашим Правилам поведения.
Отказ от ответственности
Информация и публикации не предназначены для предоставления и не являются финансовыми, инвестиционными, торговыми или другими видами советов или рекомендаций, предоставленных или одобренных TradingView. Подробнее читайте в Условиях использования.