OPEN-SOURCE SCRIPT
Structure Retest Sniper v1

Structure Retest Sniper v1 (SRS v1) is a precision-built trend continuation indicator designed to capture high-probability entries after a confirmed break of structure. By combining a triple EMA trend filter (21/50/200), swing-based market structure detection, and dynamic supply/demand zones, the script identifies when price is trending cleanly and breaking key levels. Once a breakout occurs, the system tracks a controlled pullback into value—specifically the 50 EMA—allowing traders to enter on a retest rather than chasing momentum. This creates a disciplined, rule-based approach aligned with institutional price behavior.
The indicator provides clear BUY and SELL signals only when all conditions align: trend direction, break of structure, and valid retest within a defined window. Visual elements such as zone boxes, arrows, labels, and background trend shading make chart reading simple and efficient, while built-in alerts ensure you never miss a setup. SRS v1 performs best on higher timeframes like the 1H, 4H, and Daily charts, and excels in trending markets such as Forex majors, indices, and gold—especially during high-volume sessions like London and New York. This is a clean, no-noise system built for traders who rely on structure, patience, and precision execution.
WHAT THE SCRIPT IS COMPRISED OF
1. TREND ENGINE (EMA STACK)
You’re using:
21 EMA (fast)
50 EMA (mid)
200 EMA (slow)
Logic:
Bull trend → 21 > 50 > 200
Bear trend → 21 < 50 < 200
This is filtering out bad trades and aligning you with direction.
What it means:
Market is only tradable when it's cleanly trending
No chop = fewer fake signals
2. STRUCTURE DETECTION (SWING POINTS)
Using:
ta.pivothigh
ta.pivotlow
What it does:
Finds recent highs/lows
Defines:
Resistance (highs)
Support (lows)
Important:
These are confirmed pivots, not guesswork → reduces noise.
3. SUPPLY & DEMAND ZONES
Every time a swing forms:
Pivot High → Supply Zone
Pivot Low → Demand Zone
How zones are built:
Uses 40% of the candle range
Extended forward (zone_extend)
Meaning:
These zones act as:
Reaction areas
Liquidity zones
Retest targets
4. BREAK OF STRUCTURE (BOS)
This is your trigger event.
Bullish BOS → price closes above last high
Bearish BOS → price closes below last low
Why it matters:
This confirms:
Trend continuation
Market intent
Liquidity taken
5. RETEST LOGIC (YOUR EDGE)
This is the core sniper logic.
After a BOS:
Wait up to X candles (retest_bars)
Price must pull back to:
EMA 50 (mid EMA)
Entry conditions:
BUY:
Bullish BOS happened
Price pulls back to EMA 50
Trend is bullish
SELL:
Bearish BOS happened
Price pulls back to EMA 50
Trend is bearish
This is textbook continuation entry
6. ATR BUFFER (SMART ENTRY SPACING)
Uses:
ATR(14)
Purpose:
Places labels slightly away from price
Helps visualize realistic entry zones
You can also use this for:
Stop loss placement
Risk control
7. SIGNAL SYSTEM
You get:
BUY / SELL labels
Triangle arrows
Background trend shading
Alerts
Meaning:
You’re never guessing
Signals are only printed when ALL conditions align
HOW TO USE THIS (REAL STRATEGY)
Entry Model (Simple & Effective)
BUY SETUP:
Trend = bullish (EMA aligned)
Price breaks previous high (BOS)
Price pulls back to EMA 50
BUY signal prints
Enter on:
Signal candle close OR
Lower timeframe confirmation
SELL SETUP:
Trend = bearish
Break of low (BOS)
Retest EMA 50
SELL signal prints
STOP LOSS
Best options:
Below/above retest candle
Or:
Below demand zone (for buys)
Above supply zone (for sells)
TAKE PROFIT
Use:
Previous highs/lows
Next structure level
2R–3R minimum
BEST TIMEFRAMES
This is where your indicator shines:
HIGH PROBABILITY SETUP
Daily → Bias
4H → Structure + BOS
1H → Entry (signals)
This matches exactly how you said you trade.
Alternative (Scalping):
15M → structure
5M → entries
More noise, lower accuracy
BEST MARKETS TO TRADE
This system works best on:
Forex majors
EURUSD
GBPUSD
USDJPY
Gold (XAUUSD)
Indices
NAS100
US30
Why?
Clean structure
Respect EMAs
Strong trends
BEST SESSIONS (IMPORTANT)
London Session (BEST)
Strong moves
Clean break + retest behavior
New York Session
Continuations
Volatility expansions
The indicator provides clear BUY and SELL signals only when all conditions align: trend direction, break of structure, and valid retest within a defined window. Visual elements such as zone boxes, arrows, labels, and background trend shading make chart reading simple and efficient, while built-in alerts ensure you never miss a setup. SRS v1 performs best on higher timeframes like the 1H, 4H, and Daily charts, and excels in trending markets such as Forex majors, indices, and gold—especially during high-volume sessions like London and New York. This is a clean, no-noise system built for traders who rely on structure, patience, and precision execution.
WHAT THE SCRIPT IS COMPRISED OF
1. TREND ENGINE (EMA STACK)
You’re using:
21 EMA (fast)
50 EMA (mid)
200 EMA (slow)
Logic:
Bull trend → 21 > 50 > 200
Bear trend → 21 < 50 < 200
This is filtering out bad trades and aligning you with direction.
What it means:
Market is only tradable when it's cleanly trending
No chop = fewer fake signals
2. STRUCTURE DETECTION (SWING POINTS)
Using:
ta.pivothigh
ta.pivotlow
What it does:
Finds recent highs/lows
Defines:
Resistance (highs)
Support (lows)
Important:
These are confirmed pivots, not guesswork → reduces noise.
3. SUPPLY & DEMAND ZONES
Every time a swing forms:
Pivot High → Supply Zone
Pivot Low → Demand Zone
How zones are built:
Uses 40% of the candle range
Extended forward (zone_extend)
Meaning:
These zones act as:
Reaction areas
Liquidity zones
Retest targets
4. BREAK OF STRUCTURE (BOS)
This is your trigger event.
Bullish BOS → price closes above last high
Bearish BOS → price closes below last low
Why it matters:
This confirms:
Trend continuation
Market intent
Liquidity taken
5. RETEST LOGIC (YOUR EDGE)
This is the core sniper logic.
After a BOS:
Wait up to X candles (retest_bars)
Price must pull back to:
EMA 50 (mid EMA)
Entry conditions:
BUY:
Bullish BOS happened
Price pulls back to EMA 50
Trend is bullish
SELL:
Bearish BOS happened
Price pulls back to EMA 50
Trend is bearish
This is textbook continuation entry
6. ATR BUFFER (SMART ENTRY SPACING)
Uses:
ATR(14)
Purpose:
Places labels slightly away from price
Helps visualize realistic entry zones
You can also use this for:
Stop loss placement
Risk control
7. SIGNAL SYSTEM
You get:
BUY / SELL labels
Triangle arrows
Background trend shading
Alerts
Meaning:
You’re never guessing
Signals are only printed when ALL conditions align
HOW TO USE THIS (REAL STRATEGY)
Entry Model (Simple & Effective)
BUY SETUP:
Trend = bullish (EMA aligned)
Price breaks previous high (BOS)
Price pulls back to EMA 50
BUY signal prints
Enter on:
Signal candle close OR
Lower timeframe confirmation
SELL SETUP:
Trend = bearish
Break of low (BOS)
Retest EMA 50
SELL signal prints
STOP LOSS
Best options:
Below/above retest candle
Or:
Below demand zone (for buys)
Above supply zone (for sells)
TAKE PROFIT
Use:
Previous highs/lows
Next structure level
2R–3R minimum
BEST TIMEFRAMES
This is where your indicator shines:
HIGH PROBABILITY SETUP
Daily → Bias
4H → Structure + BOS
1H → Entry (signals)
This matches exactly how you said you trade.
Alternative (Scalping):
15M → structure
5M → entries
More noise, lower accuracy
BEST MARKETS TO TRADE
This system works best on:
Forex majors
EURUSD
GBPUSD
USDJPY
Gold (XAUUSD)
Indices
NAS100
US30
Why?
Clean structure
Respect EMAs
Strong trends
BEST SESSIONS (IMPORTANT)
London Session (BEST)
Strong moves
Clean break + retest behavior
New York Session
Continuations
Volatility expansions
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。
开源脚本
秉承TradingView的精神,该脚本的作者将其开源,以便交易者可以查看和验证其功能。向作者致敬!您可以免费使用该脚本,但请记住,重新发布代码须遵守我们的网站规则。
免责声明
这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。