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.
Open-source script
In true PulseWire spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.
Open-source script
In true PulseWire spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by PulseWire. Read more in the Terms of Use.
