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.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。