OPEN-SOURCE SCRIPT

Linear % ST | QuantEdgeB

465
🚀 Introducing Linear Percentile SuperTrend (Linear % ST) by QuantEdgeB

🛠️ Overview
Linear % SuperTrend (Linear % ST) by QuantEdgeB is a hybrid trend-following indicator that combines Linear Regression, Percentile Filters, and Volatility-Based SuperTrend Logic into one dynamic tool. This system is designed to identify trend shifts early while filtering out noise during choppy market conditions.
By utilizing percentile-based median smoothing and customized ATR multipliers, this tool captures both breakout momentum and pullback opportunities with precision.

✨ Key Features
🔹 Percentile-Based Median Filtering
Removes outliers and normalizes price movement for cleaner trend detection using the 50th percentile (median) of recent price action.
🔹 Linear Regression Smoothing
A smoothed baseline is computed with Linear Regression to detect the underlying trend while minimizing lag.
🔹 SuperTrend Structure with Adaptive Bands
The indicator implements an enhanced SuperTrend engine with custom ATR bands that adapt to trend direction. Bands tighten or loosen based on volatility and trend strength.
🔹 Dynamic Long/Short Conditions
Long and short signals are derived from the relationship between price and the SuperTrend threshold zones, clearly showing trend direction with optional "Long"/"Short" labels on the chart.
🔹 Multiple Visual Themes
Select from 6 built-in color palettes including Strategy, Solar, Warm, Cool, Classic, and Magic to match your personal style or strategy layout.

📊 How It Works
1️⃣ Percentile Filtering
The source price (default: close) is filtered using a nearest-rank 50th percentile over a custom lookback. This normalizes data to reflect the central tendency and removes noisy extremes.
2️⃣ Linear Regression Trend Base
A Linear Regression Moving Average (LSMA) is applied to the filtered median, forming the core trend line. This dynamic trendline provides a low-lag yet smooth view of market direction.
3️⃣ SuperTrend Engine
ATR is applied with custom multipliers (different for long and short) to create dynamic bands. The bands react to price movement and only shift direction after confirmation, preventing false flips.
4️⃣ Trend Signal Logic
• When price stays above the dynamic lower band → Bullish trend
• When price breaks below the upper band → Bearish trend
• Trend direction remains stable until violated by price.


⚙️ Custom Settings
• Percentile Length → Lookback for percentile smoothing (default: 35)
• LSMA Length → Determines the base trend via linear regression (default: 24)
• ATR Length → ATR period used in dynamic bands (default: 14)
• Long Multiplier → ATR multiplier for bullish thresholds (default: 0.8)
• Short Multiplier → ATR multiplier for bearish thresholds (default: 1.9)

✅ How to Use
1️⃣ Trend-Following Strategy
✔️ Go Long when price breaks above the lower ATR band, initiating an upward trend
✔️ Go Short when price falls below the upper ATR band, confirming bearish conditions
✔️ Remain in trend direction until the SuperTrend flips
2️⃣ Visual Confirmation
✔️ Use bar coloring and the dynamic bands to stay aligned with trend direction
✔️ Optional Long/Short labels highlight key signal flips

👥 Who Should Use Linear % ST?
✅ Swing & Position Traders → To ride trends confidently
✅ Trend Followers → As a primary directional filter
✅ Breakout Traders → For clean signal generation post-range break
✅ Quant/Systematic Traders → Integrate clean trend logic into algorithmic setups

📌 Conclusion
Linear % ST by QuantEdgeB blends percentile smoothing with linear regression and volatility bands to deliver a powerful, adaptive trend-following engine. Whether you're a discretionary trader seeking cleaner entries or a systems-based trader building logic for automation, Linear % ST offers clarity, adaptability, and precision in trend detection.

🔹 Key Takeaways:
1️⃣ Percentile + Regression = Noise-Reduced Core Trend
2️⃣ ATR-Based SuperTrend = Reliable Breakout Confirmation
3️⃣ Flexible Parameters + Color Modes = Custom Fit for Any Strategy

📈 Use it to spot emerging trends, filter false signals, and stay confidently aligned with market momentum.

📌 Disclaimer: Past performance is not indicative of future results. No trading strategy can guarantee success in financial markets.
📌 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.

Declinazione di responsabilità

Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.