OPEN-SOURCE SCRIPT
LogTrend Retest Engine

LogTrend Retest Engine (LTRE)
LogTrend Retest Engine (LTRE) is an advanced trend-continuation overlay designed to identify high-probability breakout retests using logarithmic regression, volatility-adjusted deviation bands, and market regime filtering.
Unlike traditional channels or moving averages, LTRE models price behavior in log space, allowing it to adapt naturally to exponential market moves common in crypto, indices, and long-term trends.
🔹 How It Works
Logarithmic Regression Core
Volatility-Adjusted Deviation Bands
Adaptive Lookback (Optional)
🔹 Market Regime Detection
LTRE actively filters conditions using:
Signals are disabled during ranging or low-quality conditions.
🔹 Breakout → Retest Signal Logic
LTRE does not chase breakouts.
Signals trigger only when:
1. Price breaks cleanly outside the deviation band
2. Market regime is confirmed as trending
3. Price performs a controlled retest within a user-defined tolerance
BUY
SELL
This structure is designed to reduce false breakouts and late entries.
🔹 Visual & Projection Tools
🔹 Best Use Cases
⚠️ Disclaimer
LTRE is a decision-support tool, not a complete trading system. Always use proper risk management and confirm signals with additional structure, volume, or higher-timeframe context.
Built for traders who wait for structure — not noise.
LogTrend Retest Engine (LTRE) is an advanced trend-continuation overlay designed to identify high-probability breakout retests using logarithmic regression, volatility-adjusted deviation bands, and market regime filtering.
Unlike traditional channels or moving averages, LTRE models price behavior in log space, allowing it to adapt naturally to exponential market moves common in crypto, indices, and long-term trends.
🔹 How It Works
Logarithmic Regression Core
- Performs linear regression on log-transformed price and time
- Produces a structurally accurate trend midline that scales with price growth
Volatility-Adjusted Deviation Bands
- Dynamic upper and lower zones based on statistical deviation
- ATR weighting expands or contracts bands as volatility changes
Adaptive Lookback (Optional)
- Automatically adjusts regression length using volatility pressure
- Faster response in high-volatility environments, smoother in consolidation
🔹 Market Regime Detection
LTRE actively filters conditions using:
- R² trend strength (trend quality, not just slope)
- Volatility compression vs expansion
- User-defined minimum trend strength threshold
Signals are disabled during ranging or low-quality conditions.
🔹 Breakout → Retest Signal Logic
LTRE does not chase breakouts.
Signals trigger only when:
1. Price breaks cleanly outside the deviation band
2. Market regime is confirmed as trending
3. Price performs a controlled retest within a user-defined tolerance
BUY
- Break above upper band → retest → trend confirmed
SELL
- Break below lower band → retest → trend confirmed
This structure is designed to reduce false breakouts and late entries.
🔹 Visual & Projection Tools
- Clean midline and deviation bands
- Optional filled zones
- Optional future trend projection for forward structure planning
- On-chart statistics for trend strength and volatility compression
🔹 Best Use Cases
- Trend continuation & pullback strategies
- Crypto, Forex, Indices, and equities
- Works best on 15m and higher timeframes
⚠️ Disclaimer
LTRE is a decision-support tool, not a complete trading system. Always use proper risk management and confirm signals with additional structure, volume, or higher-timeframe context.
Built for traders who wait for structure — not noise.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน