OPEN-SOURCE SCRIPT
Morning & Evening Star Detector [SSFX]

Morning & Evening Star Detector [SSFX] is an open-source candlestick pattern indicator designed to identify two classic 3-candle reversal formations: the Morning Star and the Evening Star.
The Morning Star is a bullish reversal pattern that typically appears after bearish pressure. The indicator identifies it using a 3-candle structure:
The Evening Star is the opposite bearish reversal pattern. It is detected when the market forms:
To make the patterns easier to read on the chart, the script automatically draws a box around the full 3-candle formation:
The box covers the full high-to-low range of the entire pattern, helping traders visually study where the reversal structure formed.
Main features:
The pattern logic is fully customizable. Users can adjust the required body size of the first candle, the maximum body size of the star candle, the minimum body size of the confirmation candle, and how deeply the third candle must close into the first candle’s body.
The optional gap setting is included for traders who prefer a more classical definition of Morning Star and Evening Star patterns. Since many markets such as forex, gold, crypto, and index CFDs often do not produce clean session gaps, the gap requirement can be turned off for more flexible detection.
This indicator is intended for educational and analytical use. It does not predict future price movement and should not be used as a standalone trading system. Morning Star and Evening Star patterns are best interpreted together with market structure, support and resistance, trend context, volume, and proper risk management.
The Morning Star is a bullish reversal pattern that typically appears after bearish pressure. The indicator identifies it using a 3-candle structure:
- A strong bearish first candle
- A small-bodied middle candle, representing hesitation or loss of momentum
- A strong bullish third candle that closes back into the body of the first candle
The Evening Star is the opposite bearish reversal pattern. It is detected when the market forms:
- A strong bullish first candle
- A small-bodied middle candle
- A strong bearish third candle that closes back into the body of the first candle
To make the patterns easier to read on the chart, the script automatically draws a box around the full 3-candle formation:
- Green box = Morning Star
- Red box = Evening Star
The box covers the full high-to-low range of the entire pattern, helping traders visually study where the reversal structure formed.
Main features:
- Detects Morning Star bullish reversal patterns
- Detects Evening Star bearish reversal patterns
- Draws visual boxes around valid 3-candle patterns
- Green highlight for Morning Star formations
- Red highlight for Evening Star formations
- Optional labels for detected patterns
- Optional background highlighting
- Adjustable candle body percentage filters
- Adjustable middle candle size filter
- Adjustable third candle close requirement
- Optional gap requirement for more traditional pattern detection
- Built-in alert conditions for both pattern types
The pattern logic is fully customizable. Users can adjust the required body size of the first candle, the maximum body size of the star candle, the minimum body size of the confirmation candle, and how deeply the third candle must close into the first candle’s body.
The optional gap setting is included for traders who prefer a more classical definition of Morning Star and Evening Star patterns. Since many markets such as forex, gold, crypto, and index CFDs often do not produce clean session gaps, the gap requirement can be turned off for more flexible detection.
This indicator is intended for educational and analytical use. It does not predict future price movement and should not be used as a standalone trading system. Morning Star and Evening Star patterns are best interpreted together with market structure, support and resistance, trend context, volume, and proper risk management.
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。