OPEN-SOURCE SCRIPT

IDAHL | QuantEdgeB

139
IDAHL | QuantEdgeB

🔍 Overview
The IDAHL indicator builds adaptive, volatility-aware threshold bands from two separate ALMA lines—one smoothed from recent highs, the other from recent lows—then uses percentiles of those lines to define a dynamic “high/low” channel. Price crossing above or below that channel triggers clear long/short signals, with on-chart candle coloring, fills, optional labels and even a built-in backtest table.

✨ Key Features
• 📈 Dual ALMA Bands (with DEMA pre-smoothing)
o High ALMA: ALMA applied to DEMA-smoothed highs (high → DEMA(30) → ALMA).
o Low ALMA: ALMA applied to DEMA-smoothed lows (low → DEMA(30) → ALMA).
• 📊 Percentile Thresholds
o Computes a high threshold at the Xth percentile of the High ALMA over a lookback window.
o Computes a low threshold at the Yth percentile of the Low ALMA.
o Shifts each threshold forward by a small period to reduce repainting.
• ⚡ Dynamic Channel Logic
o When price closes above the high percentile line, the “final” threshold flips down to the low percentile line (and vice versa), creating an adaptive channel that only moves when the outer bound is violated.
o Inside the channel, the threshold holds its last value to avoid whipsaw.
• 🎨 Visual & Alerts
o Plots the two percentile lines and fills between them with a color that reflects the current regime (green for long, yellow for neutral, orange for short).
o Colors your candles to match the active signal.
o Optional “Long”/“Short” labels on confirmed flips.
o Alert conditions fire on each long/short crossover.
• 📊 On-Chart Backtest Metrics
o Toggle on a small performance table—complete with win-rate, net P/L, drawdown—from your chosen start date, without any extra code.

⚙️ How It Works
1. Adaptive Smoothing (ALMA)
o Uses ALMA (Arnaud Legoux Moving Average) for smooth, low-lag filtering. In this script, the inputs are additionally pre-smoothed with DEMA(30) to reduce noise before ALMA is applied—improving stability on highs/lows.
2. Percentile Lines
o The High ALMA series feeds a linear-interpolation percentile function to generate the upper bound; the Low ALMA produces the lower bound.
o These lines are offset by a small look-ahead (X bars) to reduce repaint behavior.
3. Channel Logic
o Breakout Flip: When the selected source (default: Close) closes above the upper bound, the active threshold “jumps” to the lower bound—locking in a new channel until price next crosses.
o Breakdown Flip: Conversely, a close below the lower bound flips the threshold to the upper bound.
4. Signal Generation
o Long while the source is above the current “final” threshold.
o Short while below.
o Neutral inside the channel before any flip.
5. Visualization & Alerts
o Dynamic fills between the two percentile lines change hue as the regime flips.
o Candles adopt the regime color.
o Optional pinned “Long”/“Short” labels at flip bars.
o Alerts on every signal crossover of the zero-based regime line.
6. Backtest Table
o From your chosen start date, a mini-table displays cumulative P/L, win rate and drawdown for this strategy—handy for quick in-chart validation.

🎯 Who Should Use It
• Breakout Traders hunting for adaptive channels that auto-recenter on new highs/lows.
• Volatility Traders who want thresholds that expand and contract with market turbulence.
• Trend-Chasers seeking a fresh take on high/low channels with built-in smoothing.
• Systematic Analysts who appreciate on-chart backtesting without leaving TradingView.

⚙️ Default Settings
• ALMA Length: 14
• Percentile Length: 35 bars
• Percentile Lookback Period (offset): 4 bars
• Upper Percentile: 92%
• Lower Percentile: 50%
• Threshold Source: Close
• Visuals: Candle coloring on, labels off by default, “Strategy” palette
• Backtest Table: on by default (toggleable)
• Start Date (Backtest): 09 Oct 2017

📌 Conclusion
IDAHL blends two smooth, low-lag ALMA filters (fed by DEMA-smoothed highs/lows) with percentile-based channel construction for a self-rewiring high/low envelope. It gives you robust breakout/breakdown signals, immediate visual context via colored fills and candles, optional labels, alerts, and even performance stats—everything you need to spot and confirm regime shifts in one compact script.

🔹 Disclaimer: Past performance is not indicative of future results. Always backtest and align settings with your risk tolerance and objectives before live trading.
🔹 Strategic Advice: Always backtest, optimize, and align parameters with your trading objectives and risk tolerance before live trading.

Haftungsausschluss

Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.