OPEN-SOURCE SCRIPT
Trend Stress Quant [MarkitTick]

💡This indicator combines a liquidity-based stress model with a dynamic linear regression channel to identify potential market exhaustion points and assess trend quality. By merging volume impact analysis with statistical deviation, this tool aims to highlight moments where price action may be overextended relative to the underlying liquidity conditions.
● Originality and Utility
Standard volatility indicators often rely solely on price range (like Bollinger Bands). This script introduces a Stress Engine that normalizes the relationship between Price Range (True Range) and Volume. This helps distinguish between healthy price movements and liquidity-stress events (illiquidity). Furthermore, instead of using a fixed-length channel, this tool offers a Dynamic Mode that anchors the regression channel to recent pivot points, ensuring the statistical analysis aligns with the current market structure rather than an arbitrary timeframe.
● Methodology
The script operates on two distinct mathematical models:
• Illiquidity Stress Engine
The core formula calculates a raw illiquidity metric based on the log-normal distribution of the ratio between True Range and Volume. A Z-Score (standard score) is then derived from this data over a specific lookback period. High Z-Scores indicate that price is moving disproportionately fast relative to the available volume, often a signature of panic selling or euphoric buying (exhaustion).
• Linear Regression Channel
📑 How to Use
Traders can utilize the visual outputs for mean reversion or trend continuation context:
• Exhaustion Signals (SE / BE Labels)
• Regression Channel
• Metrics Dashboard
A dashboard displays the current Trend Regime, Exhaustion Status, and Channel Width (volatility percentage).
● Settings
• Exhaustion Model
• Channel Configuration
📖This guide explains how to interpret and utilize signals for trading:
The script is designed primarily for Mean Reversion and Exhaustion trading strategies.
● The Core Strategy: Volatility Exhaustion
The script uses a "Stress Engine" to identify when price movement is statistically overextended relative to the available liquidity (Volume).
• Setup A: The "Seller Exhaustion" (Bullish Bounce)

Look for this setup during a downtrend to catch a temporary bottom or a reversal.

• Setup B: The "Buyer Exhaustion" (Bearish Pullback)

Look for this setup during an uptrend to catch a local top.

● The Filter: Trend & Correlation
The script includes a Linear Regression Channel that quantifies the quality of the trend.
• Channel Slope
If the channel is angling steeply up or down, the trend is strong.
• Pearson R (Correlation)
The script calculates the Pearson R coefficient.
● Risk Management & Targets
• Stop Loss
Since this is a volatility tool, a common technique is to place stops just outside the Outer Deviation Band (the widest line). If price expands beyond the outer band with no exhaustion signal, the trend may be entering a "runaway" phase.
• Take Profit
● Summary of Dashboard Metrics
The table on your chart provides a quick snapshot:
⚙️ Indicator settings
• Signal Parameters
• Channel Configuration
• Quality Filter
• Visuals
● Disclaimer
● Originality and Utility
Standard volatility indicators often rely solely on price range (like Bollinger Bands). This script introduces a Stress Engine that normalizes the relationship between Price Range (True Range) and Volume. This helps distinguish between healthy price movements and liquidity-stress events (illiquidity). Furthermore, instead of using a fixed-length channel, this tool offers a Dynamic Mode that anchors the regression channel to recent pivot points, ensuring the statistical analysis aligns with the current market structure rather than an arbitrary timeframe.
● Methodology
The script operates on two distinct mathematical models:
• Illiquidity Stress Engine
The core formula calculates a raw illiquidity metric based on the log-normal distribution of the ratio between True Range and Volume. A Z-Score (standard score) is then derived from this data over a specific lookback period. High Z-Scores indicate that price is moving disproportionately fast relative to the available volume, often a signature of panic selling or euphoric buying (exhaustion).
• Linear Regression Channel
- The script calculates an Ordinary Least Squares (OLS) regression line (the line of best fit) to determine the mean price trend.
- Standard Deviation Bands are plotted parallel to this mean.
- Pearson Correlation Coefficient (R) is calculated to quantify the strength of the linear trend. Values closer to 1 or -1 indicate a strong trend, while values near 0 indicate a chaotic or ranging market.
📑 How to Use
Traders can utilize the visual outputs for mean reversion or trend continuation context:
• Exhaustion Signals (SE / BE Labels)
- SE (Seller Exhaustion): Appears when the market is in a downtrend, but the Stress Engine detects a statistical anomaly (High Z-Score) on a down candle. This suggests panic selling may be peaking.
- BE (Buyer Exhaustion): Appears when the market is in an uptrend, but the Stress Engine detects high stress on an up candle, suggesting a potential blow-off top.
• Regression Channel
- The dashed middle line represents the fair value (mean) of the current trend.
- The outer bands represent statistical extremes. Price interacting with the outer bands (default 2 Standard Deviations) while coincident with an Exhaustion Signal provides a high-confluence area of interest.
• Metrics Dashboard
A dashboard displays the current Trend Regime, Exhaustion Status, and Channel Width (volatility percentage).
● Settings
• Exhaustion Model
- Trend Filter Length: Sets the baseline EMA to determine if the market is bullish or bearish.
- Stress Threshold (Sigma): The Z-Score required to trigger an exhaustion signal (default is 2.0).
• Channel Configuration
- Dynamic Pivot Mode: If enabled, automatically calculates the channel length based on recent pivots. If disabled, uses the Fixed Length.
- Standard Deviations: Controls the width of the inner and outer channel bands.
📖This guide explains how to interpret and utilize signals for trading:
The script is designed primarily for Mean Reversion and Exhaustion trading strategies.
● The Core Strategy: Volatility Exhaustion
The script uses a "Stress Engine" to identify when price movement is statistically overextended relative to the available liquidity (Volume).
• Setup A: The "Seller Exhaustion" (Bullish Bounce)
Look for this setup during a downtrend to catch a temporary bottom or a reversal.
- Trend Condition: The dashboard shows Bearish (Price is below the trend filter).
- Trigger: The label SE (Seller Exhaustion) appears below a candle.
- Why? This indicates that selling pressure was intense but likely panic-driven (High Z-Score/Stress) and may be drying up.
- Confluence: Ideally, this signal appears when the price is touching or piercing the Lower Channel Band (dotted or solid lines).
- Action: Traders often use this as a signal to close Short positions or enter a speculative Long (counter-trend) targeting the middle line.
• Setup B: The "Buyer Exhaustion" (Bearish Pullback)
Look for this setup during an uptrend to catch a local top.
- Trend Condition: The dashboard shows Bullish.
- Trigger: The label BE (Buyer Exhaustion) appears above a candle.
- Why? This indicates euphoric buying on low liquidity or extreme volatility that is statistically unsustainable.
- Confluence: Look for price rejection at the Upper Channel Band.
- Action: Traders often use this to close Long positions or enter a Short targeting the mean.
● The Filter: Trend & Correlation
The script includes a Linear Regression Channel that quantifies the quality of the trend.
• Channel Slope
If the channel is angling steeply up or down, the trend is strong.
• Pearson R (Correlation)
The script calculates the Pearson R coefficient.
- Weak Correlation: If the channel turns Gray/Neutral (or the fill becomes weak), it means the correlation is below the threshold (default 0.5).
- Trading Rule: Avoid trading exhaustion signals when the channel is Gray/Neutral, as the market is likely chopping sideways with no clear direction.
● Risk Management & Targets
• Stop Loss
Since this is a volatility tool, a common technique is to place stops just outside the Outer Deviation Band (the widest line). If price expands beyond the outer band with no exhaustion signal, the trend may be entering a "runaway" phase.
• Take Profit
- Target 1: The Middle Regression Line (The dashed center line). Prices tend to revert to this mean after an exhaustion event.
- Target 2: The opposite channel band (e.g., if you bought at the bottom, hold until the top).
● Summary of Dashboard Metrics
The table on your chart provides a quick snapshot:
- Trend Regime: Tells you if you should fundamentally look for Shorts (Bearish) or Longs (Bullish).
- Seller/Buyer Status: Alerts you if the current bar is EXHAUSTED or Normal.
- Channel Width %: Indicates volatility. If the width is very low (percentage is small), a breakout might be imminent (squeezing). If high, be careful of chop.
⚙️ Indicator settings
• Signal Parameters
- Exhaustion & Stress Model: Controls signal sensitivity.
- Trend Filter: Decides if the market is Bullish or Bearish.
- Stress Threshold (Sigma): Higher values (e.g., 2.5) make the script stricter, showing fewer but potentially stronger signals.
• Channel Configuration
- Dynamic Pivot Mode: If ON, the channel length auto-adjusts to recent market pivots. If OFF, it uses the Fixed Length you set.
- Channel Bands: Adjusts the channel width.
- Outer Deviation: The boundary for "extreme" moves. Price hitting this often signals a reversal.
• Quality Filter
- Filter Weak Correlations: If enabled, the channel turns gray during choppy/sideways markets to warn you not to trust trend signals.
• Visuals
- Display Options: Toggles the "Stats" dashboard and adjusts volatility coloring.
● Disclaimer
All provided scripts and indicators are strictly for educational exploration and must not be interpreted as financial advice or a recommendation to execute trades. I expressly disclaim all liability for any financial losses or damages that may result, directly or indirectly, from the reliance on or application of these tools. Market participation carries inherent risk where past performance never guarantees future returns, leaving all investment decisions and due diligence solely at your own discretion.
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
Passionate technical analysts crafting unique, proprietary indicators. We deliver fresh insights designed to redefine your understanding of the market.
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน
สคริปต์โอเพนซอร์ซ
ด้วยเจตนารมณ์หลักของ TradingView ผู้สร้างสคริปต์นี้ได้ทำให้เป็นโอเพนซอร์ส เพื่อให้เทรดเดอร์สามารถตรวจสอบและยืนยันฟังก์ชันการทำงานของมันได้ ขอชื่นชมผู้เขียน! แม้ว่าคุณจะใช้งานได้ฟรี แต่โปรดจำไว้ว่าการเผยแพร่โค้ดซ้ำจะต้องเป็นไปตาม กฎระเบียบการใช้งาน ของเรา
Passionate technical analysts crafting unique, proprietary indicators. We deliver fresh insights designed to redefine your understanding of the market.
คำจำกัดสิทธิ์ความรับผิดชอบ
ข้อมูลและบทความไม่ได้มีวัตถุประสงค์เพื่อก่อให้เกิดกิจกรรมทางการเงิน, การลงทุน, การซื้อขาย, ข้อเสนอแนะ หรือคำแนะนำประเภทอื่น ๆ ที่ให้หรือรับรองโดย TradingView อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน