OPEN-SOURCE SCRIPT
Egan's Pure Structure & S/D Strategy - Backtest

This strategy is a complete systematic approach to trading Market Structure and Supply/Demand (S/D) zones. It combines institutional price action concepts with advanced technical filters to identify high-probability reversal and continuation setups.
The strategy is designed to be fractal, performing exceptionally well on 15m, 1h, and 4h timeframes across Forex, Crypto, and Futures (including NQ/MNQ).
🚀 How It Works
The engine follows a strict 4-step validation process before executing a trade:
Market Structure (BOS): The script identifies "Pivot" highs and lows. A Break of Structure (BOS) occurs when the price closes beyond these levels, shifting the local trend.
Zone Generation: When a BOS occurs, the script automatically identifies the "Supply" or "Demand" zone—specifically the last consolidation or opposing candle before the impulsive move.
Macro Trend Filter: To increase the win rate, trades are filtered by a 200-period EMA. Longs are only allowed in macro-uptrends, and Shorts in macro-downtrends.
Rejection Confirmation: Instead of "blindly" entering a zone, the strategy waits for a Reversal Candle Confirmation. This ensures that buyers or sellers are actually defending the zone before you enter.
🛠 Key Features
Dynamic Risk/Reward Filter: Only takes trades that meet your minimum R:R requirements (e.g., 1.5 or 2.0).
Rejection Candle Entry: Logic to prevent "catching a falling knife" by waiting for price action confirmation inside the zone.
Automatic Position Sizing: Includes a "Risk % Per Trade" engine that calculates your lot size/contracts based on your stop loss distance and account equity.
Futures & Margin Ready: Built-in support for point values (NQ/MNQ/ES) and margin settings for accurate backtesting results.
Clean Dashboard: An on-chart info table shows the details of the last trade, current trend, and R:R metrics.
⚙️ How to Optimize
Pivot Lookback: Increase (15-20) for more conservative structure, or decrease (5-8) for more aggressive scalping.
Macro Filter: Toggle the 200 EMA on/off depending on whether you want to trade pullbacks or only trend continuations.
Timeframes: For the best results, use the 15m timeframe for entries while keeping an eye on the 1h or 4h for overall direction.
⚠️ Disclaimer
Backtested results do not guarantee future performance. Always use proper risk management and test the strategy on a paper trading account before using live capital.
The strategy is designed to be fractal, performing exceptionally well on 15m, 1h, and 4h timeframes across Forex, Crypto, and Futures (including NQ/MNQ).
🚀 How It Works
The engine follows a strict 4-step validation process before executing a trade:
Market Structure (BOS): The script identifies "Pivot" highs and lows. A Break of Structure (BOS) occurs when the price closes beyond these levels, shifting the local trend.
Zone Generation: When a BOS occurs, the script automatically identifies the "Supply" or "Demand" zone—specifically the last consolidation or opposing candle before the impulsive move.
Macro Trend Filter: To increase the win rate, trades are filtered by a 200-period EMA. Longs are only allowed in macro-uptrends, and Shorts in macro-downtrends.
Rejection Confirmation: Instead of "blindly" entering a zone, the strategy waits for a Reversal Candle Confirmation. This ensures that buyers or sellers are actually defending the zone before you enter.
🛠 Key Features
Dynamic Risk/Reward Filter: Only takes trades that meet your minimum R:R requirements (e.g., 1.5 or 2.0).
Rejection Candle Entry: Logic to prevent "catching a falling knife" by waiting for price action confirmation inside the zone.
Automatic Position Sizing: Includes a "Risk % Per Trade" engine that calculates your lot size/contracts based on your stop loss distance and account equity.
Futures & Margin Ready: Built-in support for point values (NQ/MNQ/ES) and margin settings for accurate backtesting results.
Clean Dashboard: An on-chart info table shows the details of the last trade, current trend, and R:R metrics.
⚙️ How to Optimize
Pivot Lookback: Increase (15-20) for more conservative structure, or decrease (5-8) for more aggressive scalping.
Macro Filter: Toggle the 200 EMA on/off depending on whether you want to trade pullbacks or only trend continuations.
Timeframes: For the best results, use the 15m timeframe for entries while keeping an eye on the 1h or 4h for overall direction.
⚠️ Disclaimer
Backtested results do not guarantee future performance. Always use proper risk management and test the strategy on a paper trading account before using live capital.
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。
開源腳本
秉持TradingView一貫精神,這個腳本的創作者將其設為開源,以便交易者檢視並驗證其功能。向作者致敬!您可以免費使用此腳本,但請注意,重新發佈代碼需遵守我們的社群規範。
免責聲明
這些資訊和出版物並非旨在提供,也不構成TradingView提供或認可的任何形式的財務、投資、交易或其他類型的建議或推薦。請閱讀使用條款以了解更多資訊。