OPEN-SOURCE SCRIPT
Master Strategy: BTC W1 Mean Reversion [Institutional SOP]

Overview This is an institutional-grade Mean Reversion and Range Rotation strategy designed specifically for Bitcoin (BTC/USDT) Perpetual Futures. It operates on the philosophy that liquidity resides at the extremes of the previous week's range (Previous Week High/Low). The strategy looks for false breakouts (Sweeps) followed by a confirmed return to the range (Reclaim), targeting the weekly equilibrium (EQ).
Core Logic: The Deviation Play Unlike standard breakout strategies, this indicator hunts for trapped liquidity.
Weekly Levels (Fixed): It calculates PWH (Previous Week High) and PWL (Previous Week Low) based on confirmed, closed weekly data. These levels act as the "Box" for the current week.
The Sweep: We wait for price to pierce the PWH or PWL (taking liquidity/stops). The script uses a dynamic ATR-based threshold to filter out noise (micro-pokes).
The Reclaim (4H Close): A signal is generated ONLY if a 4H candle closes back inside the weekly range shortly after the sweep. This confirms rejection of higher/lower prices.
The Entry: The script suggests a Limit Order at the retested level (PWH/PWL) to maximize R:R.
Institutional Quality Filters ("Kill Switches") To prevent trading in unfavorable conditions, the script includes strict SOP (Standard Operating Procedure) filters:
Trend Filter (ADX): Blocks mean reversion signals if the daily trend is too strong (ADX > 25).
Expansion Filter: Blocks signals if price accepted levels outside the range for too long (prevents fighting a true breakout).
Weekly Range Filter: Filters out weeks that are statistically too tight (chop) or too wide (expansion).
Time Filter: A reclaim must happen within a set number of 4H bars after the sweep (default: 3).
Key Features
Zero Repainting: Logic is based strictly on closed candles ([1], [2], [3]).
State Machine Logic: Uses internal memory to track sweeps regardless of chart timeframe glitches.
Operational Dashboard: Displays current status, countdown to next decision candle (4H close), and exact parameters for the last valid signal (Entry, SL, TP).
Unified Alerting: A single "Any function call" alert handles both Long and Short scenarios dynamically.
Clean Visuals: Levels are plotted with line breaks to avoid visual clutter between weeks.
How to Use
Timeframe: Set your chart to 4H. This is crucial as the logic relies on 4H closes.
Signals: Wait for the "4H RECLAIM" label.
Execution: Place a Limit Order at the suggested Level (PWH/PWL).
Stop Loss: Use the calculated SL provided by the indicator (Swing extreme + ATR buffer).
Target: TP1 is always the EQ (Equilibrium/Mid-range).
Core Logic: The Deviation Play Unlike standard breakout strategies, this indicator hunts for trapped liquidity.
Weekly Levels (Fixed): It calculates PWH (Previous Week High) and PWL (Previous Week Low) based on confirmed, closed weekly data. These levels act as the "Box" for the current week.
The Sweep: We wait for price to pierce the PWH or PWL (taking liquidity/stops). The script uses a dynamic ATR-based threshold to filter out noise (micro-pokes).
The Reclaim (4H Close): A signal is generated ONLY if a 4H candle closes back inside the weekly range shortly after the sweep. This confirms rejection of higher/lower prices.
The Entry: The script suggests a Limit Order at the retested level (PWH/PWL) to maximize R:R.
Institutional Quality Filters ("Kill Switches") To prevent trading in unfavorable conditions, the script includes strict SOP (Standard Operating Procedure) filters:
Trend Filter (ADX): Blocks mean reversion signals if the daily trend is too strong (ADX > 25).
Expansion Filter: Blocks signals if price accepted levels outside the range for too long (prevents fighting a true breakout).
Weekly Range Filter: Filters out weeks that are statistically too tight (chop) or too wide (expansion).
Time Filter: A reclaim must happen within a set number of 4H bars after the sweep (default: 3).
Key Features
Zero Repainting: Logic is based strictly on closed candles ([1], [2], [3]).
State Machine Logic: Uses internal memory to track sweeps regardless of chart timeframe glitches.
Operational Dashboard: Displays current status, countdown to next decision candle (4H close), and exact parameters for the last valid signal (Entry, SL, TP).
Unified Alerting: A single "Any function call" alert handles both Long and Short scenarios dynamically.
Clean Visuals: Levels are plotted with line breaks to avoid visual clutter between weeks.
How to Use
Timeframe: Set your chart to 4H. This is crucial as the logic relies on 4H closes.
Signals: Wait for the "4H RECLAIM" label.
Execution: Place a Limit Order at the suggested Level (PWH/PWL).
Stop Loss: Use the calculated SL provided by the indicator (Swing extreme + ATR buffer).
Target: TP1 is always the EQ (Equilibrium/Mid-range).
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน