OPEN-SOURCE SCRIPT
Cập nhật Buy/Sell EMA Trend Filter v6

Buy/Sell EMA Trend Filter v6
This indicator provides a comprehensive trading system based on EMA crossovers with trend filtering for TradingView. It's designed to identify high-probability buy and sell signals by combining short-term crossovers with longer-term trend direction confirmation.
Key Features:
EMA Crossover System: Uses fast and slow EMAs (9 and 21 by default) to generate initial signals
Trend Filtering: Confirms signals with longer-term trend direction (50 and 200 EMAs)
Automatic TP/SL Calculation: Displays clear take profit and stop loss levels based on fixed risk points
Visual Alerts: Clear buy/sell markers at the point of signal with detailed labels
Risk Management: Pre-calculated risk-to-reward setup (default 1:2 ratio)
How It Works:
Buy Signal: When the fast EMA crosses above the slow EMA while the 50 EMA is above the 200 EMA (bullish trend)
Sell Signal: When the fast EMA crosses below the slow EMA while the 50 EMA is below the 200 EMA (bearish trend)
Customizable Parameters:
Fast EMA period (default: 9)
Slow EMA period (default: 21)
Trend EMA periods (default: 50 and 200)
Fixed risk in points (default: 20)
Reward ratio (default: 2.0)
The indicator displays clear entry points with predefined stop loss and take profit levels, making it ideal for traders looking for a systematic approach to the markets. Perfect for both day trading and swing trading timeframes.
This tool combines both trend following and momentum principles to filter out low-probability trades and focus on high-quality setups where the trend and momentum align.
This indicator provides a comprehensive trading system based on EMA crossovers with trend filtering for TradingView. It's designed to identify high-probability buy and sell signals by combining short-term crossovers with longer-term trend direction confirmation.
Key Features:
EMA Crossover System: Uses fast and slow EMAs (9 and 21 by default) to generate initial signals
Trend Filtering: Confirms signals with longer-term trend direction (50 and 200 EMAs)
Automatic TP/SL Calculation: Displays clear take profit and stop loss levels based on fixed risk points
Visual Alerts: Clear buy/sell markers at the point of signal with detailed labels
Risk Management: Pre-calculated risk-to-reward setup (default 1:2 ratio)
How It Works:
Buy Signal: When the fast EMA crosses above the slow EMA while the 50 EMA is above the 200 EMA (bullish trend)
Sell Signal: When the fast EMA crosses below the slow EMA while the 50 EMA is below the 200 EMA (bearish trend)
Customizable Parameters:
Fast EMA period (default: 9)
Slow EMA period (default: 21)
Trend EMA periods (default: 50 and 200)
Fixed risk in points (default: 20)
Reward ratio (default: 2.0)
The indicator displays clear entry points with predefined stop loss and take profit levels, making it ideal for traders looking for a systematic approach to the markets. Perfect for both day trading and swing trading timeframes.
This tool combines both trend following and momentum principles to filter out low-probability trades and focus on high-quality setups where the trend and momentum align.
Phát hành các Ghi chú
What it doesA EMA crossover indicator that signals BUY when EMA 9 crosses above EMA 21 in an uptrend and SELL when EMA 9 crosses below EMA 21 in a downtrend, filtered by 50/200 EMAs to trade with the prevailing trend. It auto-labels Entry/TP/SL and fires actionable alerts with prices.
How it works
Signals: 9/21 EMA crossover aligned with 50/200 EMA trend filter.
Risk tools: Fixed points for stop loss and take profit with user-defined R:R.
Visuals: Clean labels showing Entry, TP, and SL on the chart.
Alerts: Buy/Sell alerts on bar close with price, TP, and SL details.
Inputs
Fast EMA, Slow EMA, Trend EMA (Short) 50, Trend EMA (Long) 200, Fixed Risk in Points, Reward Ratio (R), Enable Alerts.
Usage
Best for trending markets on intraday or swing timeframes.
Consider additional confirmation (ATR/volume/SR) in choppy ranges.
Set alerts: “Buy Alert” or “Sell Alert” to receive entry with TP/SL.
Alerts included
Buy Alert: EMA 9 > EMA 21 with bullish trend filter.
Sell Alert: EMA 9 < EMA 21 with bearish trend filter.
Tags
EMA, EMA9, EMA21, EMA50, EMA200, crossover, trend filter, buy sell signals, TP SL, alert, day trading, swing trading, risk management
Phát hành các Ghi chú
What it doesAn EMA crossover indicator that signals BUY when EMA 9 crosses above EMA 21 in an uptrend and SELL when EMA 9 crosses below EMA 21 in a downtrend, filtered by 50/200 EMAs to trade with the prevailing trend. It auto-labels Entry/TP/SL and fires actionable alerts with prices, with risk managed via either Fixed Ticks or ATR multiples.
How it works
Signals: 9/21 EMA crossover aligned with 50/200 EMA trend filter.
Risk tools: Choose Fixed Ticks (ticks × tick size) or ATR × multiple for adaptive SL/TP; TP is set by the user-defined R:R.
Visuals: Clean labels showing Entry, TP, SL, and the risk mode used.
Alerts: Buy/Sell alerts on bar close with Entry/TP/SL and risk mode details.
Inputs
Fast EMA, Slow EMA, Trend EMA (Short) 50, Trend EMA (Long) 200, Risk Mode (Fixed Ticks / ATR × Multiple), Fixed Risk (Ticks), ATR Length, ATR Multiple, Reward Ratio (R), Round Distances to Tick, Enable Alerts.
Usage
Best for trending markets on intraday or swing timeframes.
Start with Fixed Ticks (default 20-tick SL, 2:1 R:R), then compare ATR mode for volatility-adjusted sizing.
Set alerts: “Buy Alert” or “Sell Alert” to receive entries with TP/SL and mode info.
Alerts included
Buy Alert: EMA 9 > EMA 21 with bullish 50/200 trend filter.
Sell Alert: EMA 9 < EMA 21 with bearish 50/200 trend filter.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.
Mã nguồn mở
Theo đúng tinh thần TradingView, tác giả của tập lệnh này đã công bố nó dưới dạng mã nguồn mở, để các nhà giao dịch có thể xem xét và xác minh chức năng. Chúc mừng tác giả! Mặc dù bạn có thể sử dụng miễn phí, hãy nhớ rằng việc công bố lại mã phải tuân theo Nội quy.
Thông báo miễn trừ trách nhiệm
Thông tin và các ấn phẩm này không nhằm mục đích, và không cấu thành, lời khuyên hoặc khuyến nghị về tài chính, đầu tư, giao dịch hay các loại khác do TradingView cung cấp hoặc xác nhận. Đọc thêm tại Điều khoản Sử dụng.