Alpha S/R Channel Strategy by Awab_Hassan

By Awab_Hassan

Performance Metrics

Description

Alpha S/R Channel Strategy (ASRC)Mean-reversion strategy trading pullbacks to a dynamic Higher Timeframe EMA channel. Confirms exhaustion via Engulfing & Pin Bar patterns, with Pin+Engulf combo overriding trend filters to capture institutional liquidity grabs. Features optional RSI, BB width, and inverted Squeeze Momentum filters. Includes adaptive position sizing, partial TP, breakeven stops, session trade limits, no-trade windows, day/weekend close, and Friday trading control.📌 Strategy OverviewAlpha S/R Channel Strategy is a dual‑timeframe mean‑reversion strategy that identifies high‑probability reversal setups by combining a dynamic channel derived from a Higher Timeframe EMA with high‑conviction candlestick patterns (Engulfing and Pin Bar).The strategy waits for price to retrace to a dynamic value area (the channel) and confirms exhaustion through candlestick patterns before entering—capturing pullbacks within the prevailing trend while avoiding counter‑trend trades.🧠 Unique Edge – Why This Mashup WorksMost trend‑following strategies chase breakouts and get caught in false moves. Most engulfing strategies ignore the bigger picture and enter too early. This strategy solves both problems by combining these components in a specific sequence:1. Dynamic EMA Channel (The Value Area)Instead of using static support/resistance, the strategy constructs a dynamic channel around a Higher Timeframe EMA. The channel width adapts to volatility using three modes:- Percentage – width as % of current price.(price * (channelWidthPct / 100) )- ATR Multiplier – width based on ATR from the Higher Timeframe.- Fixed – static price distance.Why this matters: The HTF EMA represents the "fair value" or equilibrium price. When price pulls back to this zone, it's statistically more likely to resume the trend rather than reverse.-------------------------------------------------------------------2. Channel Break + Candlestick Confirmation (The Trigger)The strategy enters only when price returns to the channel AND shows exhaustion:- Bullish Engulfing – Current green candle engulfs previous red/small green candle- Bearish Engulfing – Current red candle engulfs previous green/small red candle- Pin Bar + Engulfing Combo – Pin bar sweeps recent high/low and is followed by an engulfing patternWhy this matters: The channel provides the context (where price should reverse). The candlestick patterns provide the confirmation (that reversal is actually happening). Using both drastically reduces false signals.-------------------------------------------------------------------3. Optional Multi‑Layer Filters (The Quality Control)The strategy includes configurable filters that can be enabled/disabled:1- EMA Lower TF – Ensures micro‑trend alignment (longs above EMA, shorts below)However, there is a critical override:🔄 Pin Bar + Engulfing Combo OVERRIDES the EMA ConfirmationWhen a Pin Bar sweeps the N‑bar high/low (proving a breakout attempt failed) and is immediately followed by an Engulfing pattern on the next candle, this combo represents a "double confirmation" of exhaustion that bypasses the EMA filter.Why this is a breakthrough:Strong institutional reversals (liquidity grabs) often happen against the short‑term EMA trend. A pure trend‑following strategy with a strict EMA filter would miss these reversals because price is moving against the EMA.2- Higher Timeframe EMA – Ensures long‑term trend alignment This acts as a "trend filter on top of the trend filter" – preventing entries that go against the even larger market structure. Users can select a separate timeframe (e.g., 1H) with its own EMA length for additional confirmation.3- RSI – Prevents buying above 70 and selling below 304- Bollinger Bands – Blocks entries during low volatility (sideways markets)5- Squeeze Momentum – This strategy uses an inverted Squeeze Momentum logic: "val 0 → Shorts allowed, Longs blocked" "val == 0 → Both allowed"This inversion is intentional. The strategy is mean‑reversion based—it waits for momentum to become overextended and then trades against that momentum These filters are optional because different assets and market conditions require different levels of confirmation. The user has full control.-------------------------------------------------------------------4. Comprehensive Risk ManagementThe strategy includes:- Position Sizing – Fixed percentage of equity per trade (separate for first and second entry)- Pyramiding – Allows up to 2 positions in the same direction (second trade uses lower risk)- Multiple SL Options – Low-High, Swing high/low, Channel, Fixed distance- Trade Counter Reset – Resets at session starts for scalping timeframes, daily for swing- No‑Trade Windows – Blocks entries during end‑of‑day volatility (active only for TF ≤ 15m)- Day/Week End Closing – Closes positions before gaps (configurable by timeframe)- Partial Take Profit – Closes a configurable percentage (default: 50%) at a specified R:R ratio (default: 1:2), allowing the remainder to run to the full target (default: 1:3)- Breakeven Stop – Optionally moves the stop loss to breakeven when the first TP level is reached, protecting the remaining position from turning into a lossWhy this matters: The risk controls ensure survivability across different market conditions. Also Breakeven protection reduces the risk of winning trades turning into losers.-------------------------------------------------------------------📊 How It Works1. Dynamic Channel CalculationThe strategy constructs a channel around an Exponential Moving Average (EMA) from a selected Higher Timeframe:- EMA – Calculated on the Higher Timeframe- Channel Width – Adaptive based on volatility (Percentage, ATR, or Fixed)- Upper Band = EMA + (Width / 2)- Lower Band = EMA - (Width / 2)Channel Width Modes:- Percentage – Width = Price × (User‑defined %)- ATR Multiplier – Width = ATR(14) × Multiplier- Fixed – Width = Static distance-------------------------------------------------------------------2. Entry Signal DetectionTrades are executed on the Lower Timeframe (default: 5m) when all conditions are met:Pattern Requirements (One of the following):- Bullish Engulfing: Current green candle completely engulfs previous bearish or small green candle- Bearish Engulfing: Current red candle completely engulfs previous bullish or small red candle- Pin Bar + Engulfing Combo: Pin bar sweeps recent high/low AND is followed by engulfing pattern (Overrides LTF EMA)# Engulfing Filters:Body Only – Only bodies must engulf (not full range)Min/Max Range – Configurable via Percentage, ATR, or FixedGap Allowance – Controls how much gap is allowed in the wrong directionPrevious Range % – Limits the size of the prior candle when it's in the same color# Pin Bar Detection:- Wick/Body Ratio (default: 3.0) – Wick must be 3× larger than body- Max Body/Range (default: 0.20) – Body must be ≤20% of total range- Min Wick/Range (default: 0.70) – Wick must be ≥70% of total range- Sweep Lookback (default: 10 bars) – Pin bar must sweep a recent high/lowMin Pin Bar Range % – Pin bar must meet a minimum size threshold# Channel Proximity:Price must be within the channel boundaries (open inside)-------------------------------------------------------------------3. Confirmation Filters (All Optional)- Lower Timeframe EMA : Longs require price > EMA; Shorts require price 15m – Resets once per day at session start# No‑Trade Window:- Active only for TF ≤ 15m (16:45–19:05 NY time)- Protects against end‑of‑day volatility spikes# Close All Positions:- TF ≤ 15m – Can close at day end and/or week end (configurable)- 15m 240m – Feature disabled# Entry Spacing:- Minimum Bars Between Entries (default: 4) – Prevents multiple entries on the same bar or too close together, reducing the impact of whipsaw on tightly clustered signals⚙️ Default Settings – Optimized for XAUUSD (Gold)All default values have been specifically calibrated for Gold's typical volatility and intraday structure.Setting \ Default \ Why This Works for Gold-----------------------------------------------------------------------------------Higher Timeframe \ 15m \ Gold's intraday rhythm operates on 15‑minute cycles. This timeframe captures the balance between institutional order flow and retail noise.-----------------------------------------------------------------------------------EMA Length \ 36 \ approximately one full trading session. This captures the dominant intraday trend without excessive lag.-----------------------------------------------------------------------------------Channel Width Mode \ Percentage \ Gold's price levels change over time. Percentage mode ensures the channel scales with price, maintaining consistent relative width regardless of Gold's price level.-----------------------------------------------------------------------------------Channel Width \ 0.35% \ Gold's daily range averages $30–$100. At current prices, 0.35% = approximately $113–$16. This width captures ~70% of Gold's daily volatility, creating a meaningful "value zone" that filters noise while remaining relevant.-----------------------------------------------------------------------------------Lower Timeframe \ 5m \ Fast enough to capture entry signals within the same session, slow enough to filter out micro‑noise. 5m is Gold's "sweet spot" for intraday entries.-----------------------------------------------------------------------------------Engulfing Mode \ Percentage \ Adapts to Gold's volatility. As Gold's price moves, the required engulfing range scales proportionally—ensuring consistent pattern quality.-----------------------------------------------------------------------------------Engulfing Min Range \ 0.098% \ At Gold's current price3000-5000, this ≈ $3.0–$5.0. Anything smaller is just market noise, not a meaningful reversal signal.-----------------------------------------------------------------------------------Engulfing Max Range \ 0.550% \ At Gold's current price, this ≈ $20–$25. Larger candles are often blow‑off spikes driven by news —they tend to reverse violently, making them poor entry points.-----------------------------------------------------------------------------------Previous Range % \ 0.60 \ Allows the prior candle to be up to 60% of the engulfing candle's range. This is Gold's "consolidation before reversal" pattern—a small same‑color candle before a large reversal candle.-----------------------------------------------------------------------------------Gap Allowance \ 250 ticks \ Gold's typical spread and gap behavior. (250 ticks = $0.250 However, tick values vary between brokers), which accommodates normal gaps without allowing extreme invalid gaps.-----------------------------------------------------------------------------------Pin Bar Sweep \ 10 bars \ On a 5m chart, 10 bars = 50 minutes. Gold's liquidity grabs often occur within a 30–60 minute window. 10 bars captures these recent liquidity zones without looking too far back.-----------------------------------------------------------------------------------Pin Bar Range % \ 0.70 \ Requires the pin bar(high-low) to be at least 70% of the minimum engulfing range. This ensures the pin bar has enough size to be meaningful—rejecting tiny pin bars that lack conviction.-----------------------------------------------------------------------------------Risk per Trade (1st) \ 2% \ Gold experiences 3–5 trade losing streaks regularly. 2% risk ensures that a typical losing streak results in only 6–10% drawdown—recoverable with a few winning trades.-----------------------------------------------------------------------------------Risk per Trade (2nd) \ 1% \ When pyramiding, total exposure increases. 1% on the second trade limits worst‑case loss to -3% total (2% + 1%), protecting the account during false reversals.-----------------------------------------------------------------------------------Risk:Reward \ 1:3 \ Gold routinely moves 1.5–2× its ATR in a single directional push. A 1:3 target (e.g., $15 on a $5 stop) is well within Gold's typical daily range—achievable without being overly ambitious.-----------------------------------------------------------------------------------Stop‑Loss Reference \ Channel \ Aligns the stop with the value area. If price breaks beyond the channel, the mean‑reversion thesis is invalidated. This is the most logical stop placement for this strategy.-----------------------------------------------------------------------------------Stop‑Loss Buffer \ 500 ticks \ 500 ticks = ($0.50 ) on Gold. However, tick values vary between brokers so The table on chart will display and show the calculated dollar value. This provides a safety buffer against spread, slippage, and normal wicks—preventing premature stops while keeping the stop within the value area.-----------------------------------------------------------------------------------Partial TP & Breakeven \ Disabled (50%, 1:2) \ Optional features that allow locking in partial profits and protecting positions once they move in your favor. Recommended to enable after forward testing.-----------------------------------------------------------------------------------No‑Trade Window \ Enabled \ 16:45–19:05 NY time captures the end‑of‑day volatility spike. Gold often experiences erratic moves during this period as institutional traders close positions.-----------------------------------------------------------------------------------Day End Close \ Enabled \ Gold gaps frequently at the daily open (5:00 PM NY). Closing before day end avoids these gaps, which can easily stop out tight positions. -----------------------------------------------------------------------------------Week End Close \ Enabled \ Gold is highly sensitive to weekend news (geopolitics, central banks). Gaps of $20–$50+ are common at Sunday open. Closing before Friday close is essential.-----------------------------------------------------------------------------------EMA Lower TF \ Enabled \ Ensures entries align with the 5m micro‑trend. However, the Pin+Engulf combo overrides this filter to capture institutional reversals against the trend.-----------------------------------------------------------------------------------Higher TF EMA \ Enabled (1H, 55) \ Provides an additional layer of trend confirmation at the macro level. The 1H 55‑EMA acts as a reliable gauge of the broader intraday trend, preventing entries against strong momentum.-----------------------------------------------------------------------------------RSI \ Enabled length(14) \ Prevents buying when Gold is overbought (RSI > 70) and selling when oversold (RSI 0), the strategy captures the reversal rather than chasing the continuation.-----------------------------------------------------------------------------------# Important Notes on Backtest Realism- Commission – Most ECN/raw-spread brokers charge $3.00–$3.50 per side (round-turn commission of $6.00- $7.00) for 1 standard lot (100 oz) of XAUUSD. Standard accounts usually build the fee into a wider spread instead of charging a separate cash. This strategy deducts $3.50 per entry and $3.50 per exit ($0.035 × 100 oz)round-turn commission of $7.00. Adjust this to match your broker's exact fees.- 4 ticks Slippage – For XAUUSD on OANDA, 1 tick = $0.001** per ounce (3 decimal places). 4 ticks = **$0.004 per ounce. Adjust this value if your broker quotes XAUUSD with different decimal precision (e.g., 2 decimal = $0.01 per tick).Always adjust the commission value to your broker's exact fee structure before relying on the results."A backtest without realistic commission and slippage is a fantasy. A backtest with realistic commission and slippage is a truthful reflection of what you can expect when trading live."-------------------------------------------------------------------📊 Chart DisplayChannel – Upper/Lower bands with a semi‑transparent fill (red zone), representing the value areaEMA Lower TF – Green EMA on the lower timeframe for confirmationHTF EMA Filter – Red EMA line showing the additional trend filter (plotted on all timeframes ≤ its TF)Info Table – Shows Market Status, EMA confirmations, Channel Width, Engulfing ranges, SL settings, Filters, No‑Trade Window status, Session Close statusSignal Arrows – Green arrow pointing up (below bar) for Long entries, Red arrow pointing down (above bar) for Short entriesHistorical Trades – Configurable number of past trades to display on the chart (default: 111, max: 125). Adjust this to optimize chart performance while keeping sufficient trade history for visual analysis.Reset Signal – Arrow marker (grey) indicating when the trade counter resets at session starts (Asia, London, New York for TF ≤ 15m, or daily for larger TFs)Background Colors – red for No‑Trade Window, Gray/White for Session CloseUI Note # When you adjust any setting in the Inputs tab (Channel Width, Engulfing Min/Max, Previous Range, SL Buffer, etc.), the values displayed in the info table update automatically in real‑time.This allows you to:- See the impact of your changes immediately- Verify the actual dollar values of your settings at current price levels- Fine‑tune parameters without switching between tabsExample: If you change the Channel Width from 0.35% to 0.50%, the info table will instantly show the new width in dollars (e.g., $8.50 → $12.00).# Inputs are hidden from the status line to keep the chart clean. All settings (zones, EMAs, risk, patterns) remain fully adjustable in Settings → Inputs tab.-------------------------------------------------------------------📌 In Summary: This is not a random collection of indicators.- The HTF EMA Channel provides the structural context – a dynamic value area that adapts to volatility.- The Engulfing/Pin Bar patterns provide the high‑conviction trigger – exhaustion confirmation.- The EMA Override provides the institutional edge – capturing liquidity grabs that standard EMA‑based strategies miss.- The Optional Filters provide the quality control – reducing false signals.- The Risk Management provides the survivability – realistic position sizing and stops.Each component exists specifically to compensate for a flaw in the others. This interdependency is what makes the strategy original, robust, Author: Awab_Hassan

Browse all 5,900+ TradingView Pine Script strategies

View on TradingView