OPEN-SOURCE SCRIPT
Atlantean Sideways / Range Regime Detector

Purpose
When using trend based indicators, you can skip the false signals when there is a sideways action, protecting you from the false signals.
Flags likely sideways/range phases using three checks:
Logic
Key Inputs
Quick Tuning
Use Cases
Alert
Script could be expanded upon your requests.
When using trend based indicators, you can skip the false signals when there is a sideways action, protecting you from the false signals.
Flags likely sideways/range phases using three checks:
- Weak trend (ADX from DMI)
- Price compression (Bollinger Band Width, normalized)
- Low volatility (NATR = ATR/Price%)
Logic
Pine Script® isSideways = (ADX < adxThresh) AND (bbNorm < 0.25) AND (NATR < natrMax)- When true: bars + background turn teal and a provisional Range High/Low (rolling rangeWin) is drawn.
Key Inputs
- DMI: diLen(22)
Optimized for 15 mins Bitcoin, could change it to 14 for more general approach - ADX: adxSmooth(14), adxThresh(18)
- Volatility: lenATR(14), natrMax(1.8)
- Visuals: rangeWin(20), bar/range toggles
Quick Tuning
- More signals: raise adxThresh to 20–25, raise natrMax to 2.5–4.0, increase BB cutoff by editing bbNorm < 0.25 --> 0.35–0.50.
- Smoother range lines: increase rangeWin to 30–40.
Use Cases
- Mean reversion inside teal ranges.
- Breakout prep when price closes outside the drawn range after teal ends. Could be used as a signal although not suggested.
- Filter trend systems: skip trades when sidewaysCond is true. This is the main purpose, for it to be combined with trend based indicators, like Supertrend.
Alert
- “Sideways Detected” triggers when isSideways is true.
Script could be expanded upon your requests.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้มันเป็นโอเพ่นซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันการทำงานของสคริปต์ได้ ขอแสดงความชื่นชมผู้เขียน! แม้ว่าคุณจะสามารถใช้งานได้ฟรี แต่อย่าลืมว่าการเผยแพร่โค้ดซ้ำนั้นจะต้องเป็นไปตามกฎระเบียบการใช้งานของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมที่ ข้อกำหนดการใช้งาน