OPEN-SOURCE SCRIPT
MQE - Market Quality Engine v1.6

# MQE — Market Quality Engine v1.6
**MQE is not a buy/sell signal generator.** It is a Decision Support System that measures the quality of the current market environment on a standardized 0-100 scale. Its purpose is not to dictate "Buy" or "Sell," but to present, transparently and explainably, how favorable current market conditions are for opening a directional position.
## Methodology
MQE combines evidence from five independent analytical engines:
- **Trend Engine** — Evaluates market structure direction using EMA structure, AlphaTrend, and Comparative Relative Strength (CRS) against a benchmark (default BIST:XU100).
- **Flow Engine** — Measures directional capital commitment using a Cumulative Delta Volume (CDV) approximation; unlike raw volume, it prioritizes directional information over mere activity. The engine's highest-weighted criterion (40%) is whether CDV's fast average (EMA5) remains above its slow average (SMA68) — a strong, sustained CDV reading is interpreted as confirmation that the underlying scenario has not broken down.
- **Opportunity Conditions Engine** — Built around Relative ATR, this engine evaluates "tradability" rather than raw volatility; neither extreme compression nor extreme expansion is treated as inherently favorable.
- **Participation Engine** — Uses Relative Volume to assess whether sufficient market participation supports the current move; it is non-directional and primarily feeds into the Confidence output.
- **Momentum Engine** — MFI-based; deliberately avoids classic overbought/oversold interpretation and instead evaluates the persistence of directional energy as a supporting, confirmatory layer.
The output of these five engines is combined using regime-adaptive weighting — based on the current market **Regime** (Bull Trend / Bear Trend / Range / Transition) — into independent **Long Score** and **Short Score** values (0-100). Contradictions between engines are captured separately by a **Penalty** mechanism that only ever reduces the score, while the internal consistency of the evidence is reported through a fully independent **Confidence** value (0-100) that never alters the score itself. A high score paired with low confidence signals an environment that looks attractive but is backed by inconsistent evidence; high score with high confidence signals strong agreement across all evidence families.
For quick manual screening, MQE also provides a composite **Grade** (A+ through D), calculated separately for both directions.
## Dashboard
Two independent panels are provided: a **Primary Dashboard** (Long/Short Score, Confidence, Regime, and per-engine summaries — shown side-by-side for both the last closed bar and the live bar), and a **Diagnostics Panel** (per-engine breakdowns, penalty sources, raw indicator values, and active confirmation timeframes).
## Timeframe Adaptivity
Higher-timeframe confirmation and the AlphaTrend calculation automatically scale to the chart's timeframe (from 5-minute up to weekly), so no manual configuration is required by default; manual overrides remain available for advanced customization.
## Credit
The AlphaTrend calculation logic is adapted from the publicly known AlphaTrend concept originally developed by Kıvanç Özbilgiç.
## Disclaimer
MQE is not financial advice; it provides a statistical assessment of market conditions only. Past performance or evidence consistency does not guarantee future price behavior. All trading decisions and risk management remain the sole responsibility of the user.
**MQE is not a buy/sell signal generator.** It is a Decision Support System that measures the quality of the current market environment on a standardized 0-100 scale. Its purpose is not to dictate "Buy" or "Sell," but to present, transparently and explainably, how favorable current market conditions are for opening a directional position.
## Methodology
MQE combines evidence from five independent analytical engines:
- **Trend Engine** — Evaluates market structure direction using EMA structure, AlphaTrend, and Comparative Relative Strength (CRS) against a benchmark (default BIST:XU100).
- **Flow Engine** — Measures directional capital commitment using a Cumulative Delta Volume (CDV) approximation; unlike raw volume, it prioritizes directional information over mere activity. The engine's highest-weighted criterion (40%) is whether CDV's fast average (EMA5) remains above its slow average (SMA68) — a strong, sustained CDV reading is interpreted as confirmation that the underlying scenario has not broken down.
- **Opportunity Conditions Engine** — Built around Relative ATR, this engine evaluates "tradability" rather than raw volatility; neither extreme compression nor extreme expansion is treated as inherently favorable.
- **Participation Engine** — Uses Relative Volume to assess whether sufficient market participation supports the current move; it is non-directional and primarily feeds into the Confidence output.
- **Momentum Engine** — MFI-based; deliberately avoids classic overbought/oversold interpretation and instead evaluates the persistence of directional energy as a supporting, confirmatory layer.
The output of these five engines is combined using regime-adaptive weighting — based on the current market **Regime** (Bull Trend / Bear Trend / Range / Transition) — into independent **Long Score** and **Short Score** values (0-100). Contradictions between engines are captured separately by a **Penalty** mechanism that only ever reduces the score, while the internal consistency of the evidence is reported through a fully independent **Confidence** value (0-100) that never alters the score itself. A high score paired with low confidence signals an environment that looks attractive but is backed by inconsistent evidence; high score with high confidence signals strong agreement across all evidence families.
For quick manual screening, MQE also provides a composite **Grade** (A+ through D), calculated separately for both directions.
## Dashboard
Two independent panels are provided: a **Primary Dashboard** (Long/Short Score, Confidence, Regime, and per-engine summaries — shown side-by-side for both the last closed bar and the live bar), and a **Diagnostics Panel** (per-engine breakdowns, penalty sources, raw indicator values, and active confirmation timeframes).
## Timeframe Adaptivity
Higher-timeframe confirmation and the AlphaTrend calculation automatically scale to the chart's timeframe (from 5-minute up to weekly), so no manual configuration is required by default; manual overrides remain available for advanced customization.
## Credit
The AlphaTrend calculation logic is adapted from the publicly known AlphaTrend concept originally developed by Kıvanç Özbilgiç.
## Disclaimer
MQE is not financial advice; it provides a statistical assessment of market conditions only. Past performance or evidence consistency does not guarantee future price behavior. All trading decisions and risk management remain the sole responsibility of the user.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.