OPEN-SOURCE SCRIPT
9 EMA First Full Candle Entry + EMA Cross Exit (Strategy)

This strategy is designed to create a simple, mechanical trading system using only the 9 EMA on the 5-minute chart.
Entry Logic
A trade is entered on the first candle that closes completely on one side of the 9 EMA:
Long entry: the candle’s low is above the 9 EMA
Short entry: the candle’s high is below the 9 EMA
Only the first qualifying candle is used, preventing repeated entries during the same move.
Exit Logic
Once in a trade, the position is closed when price crosses back through the 9 EMA:
Long exits when price crosses below the EMA
Short exits when price crosses above the EMA
On the exit candle, the 9 EMA is highlighted yellow to clearly mark the exit point.
Visual Cues
Entry candle is colored yellow
EMA is normally orange and turns yellow on the exit candle only
No background shading, labels, or extra indicators
Purpose
This strategy is built to minimize decisions by:
Using a single timeframe (5-minute)
Using a single indicator (9 EMA)
Defining objective entry and exit rules
Designed for:
SPY and other highly liquid ETFs
Intraday trend continuation
Clean, rules-based execution with minimal discretion
Best performance is typically seen during strong trend periods and reduced during sideways or low-volatility conditions.
Entry Logic
A trade is entered on the first candle that closes completely on one side of the 9 EMA:
Long entry: the candle’s low is above the 9 EMA
Short entry: the candle’s high is below the 9 EMA
Only the first qualifying candle is used, preventing repeated entries during the same move.
Exit Logic
Once in a trade, the position is closed when price crosses back through the 9 EMA:
Long exits when price crosses below the EMA
Short exits when price crosses above the EMA
On the exit candle, the 9 EMA is highlighted yellow to clearly mark the exit point.
Visual Cues
Entry candle is colored yellow
EMA is normally orange and turns yellow on the exit candle only
No background shading, labels, or extra indicators
Purpose
This strategy is built to minimize decisions by:
Using a single timeframe (5-minute)
Using a single indicator (9 EMA)
Defining objective entry and exit rules
Designed for:
SPY and other highly liquid ETFs
Intraday trend continuation
Clean, rules-based execution with minimal discretion
Best performance is typically seen during strong trend periods and reduced during sideways or low-volatility conditions.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.
Script open-source
Dans l'esprit TradingView, le créateur de ce script l'a rendu open source afin que les traders puissent examiner et vérifier ses fonctionnalités. Bravo à l'auteur! Bien que vous puissiez l'utiliser gratuitement, n'oubliez pas que la republication du code est soumise à nos Règles.
Clause de non-responsabilité
Les informations et publications ne sont pas destinées à être, et ne constituent pas, des conseils ou recommandations financiers, d'investissement, de trading ou autres fournis ou approuvés par TradingView. Pour en savoir plus, consultez les Conditions d'utilisation.