OPEN-SOURCE SCRIPT
Updated 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.
Release Notes
Updated calculation logic for zonesRelease Notes
Updated chartOpen-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.