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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.