Median EMA IQR Bands | Oquant

The Median EMA IQR Bands indicator introduces a robust trend-following tool that combines a median-filtered exponential moving average (EMA) with interquartile range (IQR) based bands to identify potential entry and exit points for long and short positions. This approach aims to reduce noise in traditional EMAs while incorporating a statistical measure of volatility to create adaptive bands. Unlike standard moving average crossovers or Bollinger Bands, this indicator uses median filtering on the EMA and IQR for band construction, which can help in filtering outliers and providing a more stable view of market trends. It also includes built-in performance metrics displayed in tables, allowing users to evaluate the indicator's historical behavior against buy-and-hold benchmarks directly on the chart(remember past performance doesn’t guarantee future results).
Key Factors/Components
Median-Filtered EMA: A core trend line derived from an EMA that is further smoothed using a median calculation to minimize the impact of extreme price movements.
IQR Bands: Upper and lower bands built around the median EMA using the interquartile range, multiplied by a user-defined factor, to capture volatility without assuming a normal distribution like standard deviation-based methods.
Signal Generation: Simple conditions for long (price above upper band) and short (price below lower band) allocations, with options to enable/disable longs or shorts.
Performance Metrics: Tables showing risk-adjusted metrics such as Sharpe, Sortino, Omega ratios, max drawdown, intra-trade max drawdown, percent profitable trades, profit factor, total trades, and net profit for the indicator's simulated equity curve, compared to buy-and-hold.
Equity Curve Plot: Optional plotting of a simulated equity curve based on the indicator's allocations.
Visual Elements: Color-coded plots, fills, and bar coloring for clear signal visualization(green for bullish and purple for bearish.
How It Works
The indicator starts by calculating a standard EMA on the selected source (default close price), then applies a median filter over a specified length to create the central trend line. This helps in reducing whipsaws common in volatile markets. Separately, it computes the IQR from recent price data as a non-parametric measure of spread, which is then scaled by a multiplier and added/subtracted from the median EMA to form the upper and lower bands. Allocations shift to long when price closes above the upper band (if longs are enabled), to short when below the lower band (if shorts are enabled), or to cash otherwise(For example if it’s bearish signal but shorts are disabled then it will be cash). The equity curve and metrics are derived from these allocations, simulating returns while accounting for user preferences on position types. This logic emphasizes trend persistence filtered through statistical robustness, but users should note it may cause false signals in ranging markets and perform better in trending conditions.
For Who It Is Best/Recommended Use Cases
This indicator is best suited for trend-following traders or investors who prefer statistical, outlier-resistant methods over traditional indicators. It is recommended for:
Intermediate to advanced users analyzing cryptocurrencies on daily or other timeframes.
Those incorporating it into broader systems.
Risk-averse traders who value drawdown insights and adjustable band sensitivity for customizing to specific assets. It is not ideal for high-frequency trading or very short-term scalping.
Settings and Default Settings
Start Date: Timestamp for when metrics and equity calculations begin (default: 1 Jan 2018).
Source: Price source for calculations (default: close).
EMA Length: Period for the underlying EMA (default: 30).
Median Length: Window for median filtering on the EMA (default: 20).
Interquartile Range Length: Period for IQR calculation (default: 20).
Band Multiplier: Factor to scale the IQR for bands (default: 1.2).
Allow Long Trades: Enable long positions (default: true); if false, defaults to cash.
Allow Shorts: Enable short positions (default: false); if false, defaults to cash.
Show Indicator Metrics Table: Display the performance table (default: true).
Show Buy&Hold Table: Display benchmark table (default: true).
Plot Equity Curve: Show simulated equity line (default: false).
These defaults are tuned for general use on daily charts, but users should adjust based on asset volatility—e.g., increase multiplier for tighter bands in low-vol environments.
Conclusion
The Median EMA IQR Bands offers a fresh take on trend detection by blending median smoothing with IQR volatility measures, providing traders with a tool that prioritizes stability and insightful metrics(remember past performance doesn’t guarantee future results). It encourages informed decision-making through transparent performance visuals(remember past performance doesn’t guarantee future results), making it a valuable addition for those looking to enhance their technical analysis toolkit.
⚠️ Disclaimer: This indicator is intended for educational and informational purposes only. Trading/investing involves risk, and past performance does not guarantee future results. Always test and evaluate indicators/strategies before applying them in live markets. Use at your own risk.
Skrip jemputan sahaja
Hanya pengguna yang diluluskan oleh penulis boleh mengakses skrip ini. Anda perlu memohon dan mendapatkan kebenaran untuk menggunakannya. Ini selalunya diberikan selepas pembayaran. Untuk lebih butiran, ikuti arahan penulis di bawah atau hubungi terus oquant.
TradingView tidak menyarankan pembayaran untuk atau menggunakan skrip kecuali anda benar-benar mempercayai penulisnya dan memahami bagaimana ia berfungsi. Anda juga boleh mendapatkan alternatif sumber terbuka lain yang percuma dalam skrip komuniti kami.
Arahan penulis
oquantsystems.com
Penafian
Skrip jemputan sahaja
Hanya pengguna yang diluluskan oleh penulis boleh mengakses skrip ini. Anda perlu memohon dan mendapatkan kebenaran untuk menggunakannya. Ini selalunya diberikan selepas pembayaran. Untuk lebih butiran, ikuti arahan penulis di bawah atau hubungi terus oquant.
TradingView tidak menyarankan pembayaran untuk atau menggunakan skrip kecuali anda benar-benar mempercayai penulisnya dan memahami bagaimana ia berfungsi. Anda juga boleh mendapatkan alternatif sumber terbuka lain yang percuma dalam skrip komuniti kami.
Arahan penulis
oquantsystems.com