OPEN-SOURCE SCRIPT
已更新 Supply/Demand Zones + Engulfment-based Execution

Supply/Demand Zones + Engulfment-Based Execution
Strategy Overview
This strategy combines institutional trading concepts—supply/demand zones and engulfing candle patterns—to generate high-probability long and short trade setups. The system uses aggregated price action to identify potential reversal zones and confirms entries with engulfing candle patterns, ensuring trades are only taken when market structure shows commitment in the direction of the trade.
Core Concepts
• Supply & Demand Zones: These are automatically detected by analyzing aggregated bullish and bearish candle structures over user-defined intervals. Supply zones are formed after bearish continuation patterns; demand zones appear after bullish continuation patterns.
• Engulfing Entries: Once price enters a zone, the strategy waits for a bullish engulfing pattern (in a demand zone) or a bearish engulfing pattern (in a supply zone) before executing a trade. This adds confirmation and reduces false signals.
• Risk Management: Stop-loss is placed at the low (for long trades) or high (for short trades) of the engulfed candle. Take-profit can be calculated using a fixed R-multiple (risk-to-reward ratio) or a user-defined target price.
Key Features
[✅] Fully customizable aggregation factor for zone detection
[✅] Visual zone boxes, entry/SL/TP boxes, and engulfing pattern labels
[✅] Optional removal of mitigated zones for cleaner charting
[✅] Configurable trade mode (Long only, Short only, or Both)
[✅] Support for trading sessions and date filtering
[✅] Alerts for price entering supply or demand zones
How to Use
[1] Select Aggregation Factor: Choose how many candles to group together for identifying key zones (e.g., 4x timeframe).
[2] Enable Zones: Turn on supply and/or demand zones as needed.
[3] Set Execution Parameters:
– Choose R-multiple (e.g., 2:1 risk-reward)
– Or use a fixed take-profit price
[4] Define Trade Time Window:
– Set the date and time ranges to restrict execution
– Use Start Hour and End Hour to limit trades to specific sessions (e.g., London/New York)
[5] Run on Desired Timeframe: Typically used on 15m–4H charts, depending on your strategy and the asset’s volatility.
Ideal For
• Traders using Smart Money Concepts (SMC)
• Those who value high-confluence entries
• Intraday to swing traders looking for structure-based automation
⚠️ Important Notes
• The strategy requires engulfing confirmation within the zone to enter a position.
• This script does not repaint and executes trades on a bar close basis.
• Backtest results may vary based on session filters and aggregation factor.
© Attribution
This strategy was developed by The_Forex_Steward and is licensed under the Mozilla Public License 2.0.
You are free to use, modify, and distribute it under the terms of that license.
Strategy Overview
This strategy combines institutional trading concepts—supply/demand zones and engulfing candle patterns—to generate high-probability long and short trade setups. The system uses aggregated price action to identify potential reversal zones and confirms entries with engulfing candle patterns, ensuring trades are only taken when market structure shows commitment in the direction of the trade.
Core Concepts
• Supply & Demand Zones: These are automatically detected by analyzing aggregated bullish and bearish candle structures over user-defined intervals. Supply zones are formed after bearish continuation patterns; demand zones appear after bullish continuation patterns.
• Engulfing Entries: Once price enters a zone, the strategy waits for a bullish engulfing pattern (in a demand zone) or a bearish engulfing pattern (in a supply zone) before executing a trade. This adds confirmation and reduces false signals.
• Risk Management: Stop-loss is placed at the low (for long trades) or high (for short trades) of the engulfed candle. Take-profit can be calculated using a fixed R-multiple (risk-to-reward ratio) or a user-defined target price.
Key Features
[✅] Fully customizable aggregation factor for zone detection
[✅] Visual zone boxes, entry/SL/TP boxes, and engulfing pattern labels
[✅] Optional removal of mitigated zones for cleaner charting
[✅] Configurable trade mode (Long only, Short only, or Both)
[✅] Support for trading sessions and date filtering
[✅] Alerts for price entering supply or demand zones
How to Use
[1] Select Aggregation Factor: Choose how many candles to group together for identifying key zones (e.g., 4x timeframe).
[2] Enable Zones: Turn on supply and/or demand zones as needed.
[3] Set Execution Parameters:
– Choose R-multiple (e.g., 2:1 risk-reward)
– Or use a fixed take-profit price
[4] Define Trade Time Window:
– Set the date and time ranges to restrict execution
– Use Start Hour and End Hour to limit trades to specific sessions (e.g., London/New York)
[5] Run on Desired Timeframe: Typically used on 15m–4H charts, depending on your strategy and the asset’s volatility.
Ideal For
• Traders using Smart Money Concepts (SMC)
• Those who value high-confluence entries
• Intraday to swing traders looking for structure-based automation
⚠️ Important Notes
• The strategy requires engulfing confirmation within the zone to enter a position.
• This script does not repaint and executes trades on a bar close basis.
• Backtest results may vary based on session filters and aggregation factor.
© Attribution
This strategy was developed by The_Forex_Steward and is licensed under the Mozilla Public License 2.0.
You are free to use, modify, and distribute it under the terms of that license.
版本注释
Updated calculation logic for zones版本注释
Updated chart开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。
开源脚本
本着TradingView的真正精神,此脚本的创建者将其开源,以便交易者可以查看和验证其功能。向作者致敬!虽然您可以免费使用它,但请记住,重新发布代码必须遵守我们的网站规则。
免责声明
这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。