OPEN-SOURCE SCRIPT
Tristan's Box: Pre-Market Range Breakout + Retest

Market Context:
This is designed for U.S. stocks, focusing on pre-market price action (4:00–9:30 AM ET) to identify key support/resistance levels before the regular session opens.
Built for 1 min and 5 min timelines, and is intended for day trading / scalping.
Core Idea:
Step-by-Step Logic:
Breakout Detection:
Retest Confirmation:
Entry Execution:
Visuals & Alerts:
Strategy Type:
In short, it’s a pre-market breakout momentum strategy: it uses the pre-market high/low as reference, waits for a breakout, and then enters only after a confirmation retest, reducing the chance of entering on a false spike.
Always use good risk management.
This is designed for U.S. stocks, focusing on pre-market price action (4:00–9:30 AM ET) to identify key support/resistance levels before the regular session opens.
Built for 1 min and 5 min timelines, and is intended for day trading / scalping.
Core Idea:
- Pre-market range (high/low) often acts as a magnet for price during regular hours.
- The first breakout outside this range signals potential strong momentum in that direction.
- Retest of the breakout level confirms whether the breakout is valid, avoiding false moves.
Step-by-Step Logic:
- Pre-Market Range Identification:
- Track high and low from 4:00–9:30 AM ET.
- Draw a box spanning this range for visual reference and calculation.
Breakout Detection:
- When the first candle closes above the pre-market high → long breakout.
- When the first candle closes below the pre-market low → short breakout.
- The first breakout candle is highlighted with a “YOLO” label for visual confirmation.
Retest Confirmation:
- Identify the first candle whose wick touches the pre-market box (high touches top for short, low touches bottom for long).
- Wait for the next candle: if it closes outside the box, it confirms the breakout.
Entry Execution:
- Long entry: on the confirming candle after a wick-touch above the pre-market high.
- Short entry: on the confirming candle after a wick-touch below the pre-market low.
- Only the first valid entry per direction per day is taken.
Visuals & Alerts:
- Box represents pre-market high/low.
- Top/bottom box border lines show the pre-market high / low levels cleanly.
- BUY/SELL markers are pinned to the confirming candle.
- Added a "YOLO" marker on breakout candle.
- Alert conditions trigger when a breakout is confirmed by the retest.
Strategy Type:
- Momentum breakout strategy with confirmation retest.
- Combines pre-market structure and risk-managed entries.
- Designed to filter false breakouts by requiring confirmation on the candle after the wick-touch.
In short, it’s a pre-market breakout momentum strategy: it uses the pre-market high/low as reference, waits for a breakout, and then enters only after a confirmation retest, reducing the chance of entering on a false spike.
Always use good risk management.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน