OPEN-SOURCE SCRIPT
EMA 9/21 GoldenX Pro-TSL

█ OVERVIEW
EMA GoldenX Pro-TS is a trend-following strategy built around the classic EMA crossover (Golden Cross / Death Cross), enhanced with multi-layer confirmation filters and dynamic risk management. It is designed for traders who want clean, rule-based entries while avoiding choppy, low-conviction signals.
█ HOW IT WORKS
ENTRY LOGIC
• A Long entry triggers when the Fast EMA crosses above the Slow EMA (Golden Cross), confirmed by rising volume OR rising price action, AND a trending market condition (ADX filter).
• A Short entry triggers when the Fast EMA crosses below the Slow EMA (Death Cross), confirmed by rising volume OR falling price action, AND a trending market condition.
POSITION FLIPPING
• When already in a position and the opposite EMA cross occurs, the strategy can instantly close and reverse (flip). The "Flip on EMA cross only" option lets you bypass the volume/ADX filters on reversal signals — useful for fast-moving markets where waiting for full confirmation may cause late entries.
STOP-LOSS MANAGEMENT
• A dynamic ATR-based trailing stop is calculated each bar.
• A hard percentage-based maximum stop loss acts as a safety net.
• The tighter of the two is always used, providing adaptive risk control that respects both volatility and absolute drawdown limits.
█ FEATURES
• Dual EMA Crossover — Configurable Fast (default 9) and Slow (default 21) EMA periods.
• ADX Trend Filter — Filters out entries during range-bound / low-momentum conditions (ADX threshold + DI spread).
• Volume Confirmation — Requires volume above its 5-bar SMA for fresh entries.
• Price Momentum Check — Validates price direction relative to a 5-bar SMA for additional confluence.
• ATR Trailing Stop — Volatility-adjusted stop that adapts to current market conditions.
• Max Stop Loss % — Hard cap on per-trade risk as a percentage of entry price.
• Trade Direction Control — Choose Long only, Short only, or Both.
• Instant Position Flip — Optionally reverses on EMA cross without waiting for all filters to align.
• Alert Conditions — Built-in alerts for Golden Cross (Long) and Death Cross (Short) signals.
█ SETTINGS
• Fast EMA (default: 9) — Period for the fast EMA line.
• Slow EMA (default: 21) — Period for the slow EMA line.
• Trade Direction (default: Both) — Restrict to Long, Short, or trade Both sides.
• ADX Length (default: 14) — Lookback period for the ADX/DMI calculation.
• ADX Threshold (default: 20) — Minimum ADX value to qualify as a trending market.
• ATR Length (default: 14) — Lookback period for the ATR calculation.
• ATR Multiplier (default: 2.0) — Distance of the ATR trailing stop from the current close.
• Max Stop Loss % (default: 1.0%) — Maximum allowable stop distance as a % of entry price.
• Flip on EMA Cross Only (default: true) — When enabled, position reversals only require the EMA cross, bypassing volume/ADX filters for faster flips.
█ VISUAL OUTPUTS
• Orange line — Fast EMA
• Blue line — Slow EMA
• Red line — Active trailing stop level (visible only while in a position)
█ USAGE NOTES
• Originally designed and tested on TFEX SET50 Index Futures but applicable to any liquid instrument.
• Best suited for trending markets on intraday to swing timeframes.
• Adjust EMA periods and ATR multiplier to match the volatility profile of your instrument.
• Backtest thoroughly on your target market before live deployment.
█ DISCLAIMER
This strategy is provided for educational and research purposes only. Past performance does not guarantee future results. Always manage your risk and trade responsibly.
EMA GoldenX Pro-TS is a trend-following strategy built around the classic EMA crossover (Golden Cross / Death Cross), enhanced with multi-layer confirmation filters and dynamic risk management. It is designed for traders who want clean, rule-based entries while avoiding choppy, low-conviction signals.
█ HOW IT WORKS
ENTRY LOGIC
• A Long entry triggers when the Fast EMA crosses above the Slow EMA (Golden Cross), confirmed by rising volume OR rising price action, AND a trending market condition (ADX filter).
• A Short entry triggers when the Fast EMA crosses below the Slow EMA (Death Cross), confirmed by rising volume OR falling price action, AND a trending market condition.
POSITION FLIPPING
• When already in a position and the opposite EMA cross occurs, the strategy can instantly close and reverse (flip). The "Flip on EMA cross only" option lets you bypass the volume/ADX filters on reversal signals — useful for fast-moving markets where waiting for full confirmation may cause late entries.
STOP-LOSS MANAGEMENT
• A dynamic ATR-based trailing stop is calculated each bar.
• A hard percentage-based maximum stop loss acts as a safety net.
• The tighter of the two is always used, providing adaptive risk control that respects both volatility and absolute drawdown limits.
█ FEATURES
• Dual EMA Crossover — Configurable Fast (default 9) and Slow (default 21) EMA periods.
• ADX Trend Filter — Filters out entries during range-bound / low-momentum conditions (ADX threshold + DI spread).
• Volume Confirmation — Requires volume above its 5-bar SMA for fresh entries.
• Price Momentum Check — Validates price direction relative to a 5-bar SMA for additional confluence.
• ATR Trailing Stop — Volatility-adjusted stop that adapts to current market conditions.
• Max Stop Loss % — Hard cap on per-trade risk as a percentage of entry price.
• Trade Direction Control — Choose Long only, Short only, or Both.
• Instant Position Flip — Optionally reverses on EMA cross without waiting for all filters to align.
• Alert Conditions — Built-in alerts for Golden Cross (Long) and Death Cross (Short) signals.
█ SETTINGS
• Fast EMA (default: 9) — Period for the fast EMA line.
• Slow EMA (default: 21) — Period for the slow EMA line.
• Trade Direction (default: Both) — Restrict to Long, Short, or trade Both sides.
• ADX Length (default: 14) — Lookback period for the ADX/DMI calculation.
• ADX Threshold (default: 20) — Minimum ADX value to qualify as a trending market.
• ATR Length (default: 14) — Lookback period for the ATR calculation.
• ATR Multiplier (default: 2.0) — Distance of the ATR trailing stop from the current close.
• Max Stop Loss % (default: 1.0%) — Maximum allowable stop distance as a % of entry price.
• Flip on EMA Cross Only (default: true) — When enabled, position reversals only require the EMA cross, bypassing volume/ADX filters for faster flips.
█ VISUAL OUTPUTS
• Orange line — Fast EMA
• Blue line — Slow EMA
• Red line — Active trailing stop level (visible only while in a position)
█ USAGE NOTES
• Originally designed and tested on TFEX SET50 Index Futures but applicable to any liquid instrument.
• Best suited for trending markets on intraday to swing timeframes.
• Adjust EMA periods and ATR multiplier to match the volatility profile of your instrument.
• Backtest thoroughly on your target market before live deployment.
█ DISCLAIMER
This strategy is provided for educational and research purposes only. Past performance does not guarantee future results. Always manage your risk and trade responsibly.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。