From d99659d2595eaeac15a0c2a24b7009f9fcdb76d9 Mon Sep 17 00:00:00 2001 From: Toh4iem9 Date: Mon, 16 Feb 2026 13:54:06 +0100 Subject: [PATCH] docs(scripts): refactor --- Scripts/MyScripts/Market_Scanner_Pro.md | 129 +++++++++++------------- 1 file changed, 60 insertions(+), 69 deletions(-) diff --git a/Scripts/MyScripts/Market_Scanner_Pro.md b/Scripts/MyScripts/Market_Scanner_Pro.md index d45d938..20536b4 100644 --- a/Scripts/MyScripts/Market_Scanner_Pro.md +++ b/Scripts/MyScripts/Market_Scanner_Pro.md @@ -2,86 +2,77 @@ ## 1. Summary (Introduction) -The `Market_Scanner_Pro` is a high-performance quantitative analysis tool designed to bridge the gap between technical charting and AI-assisted trading. It is an "Institutional Market X-Ray" that performs a multi-timeframe, multi-indicator scan across a portfolio of assets and exports the market state into a structured CSV format. +**Market Scanner Pro** is an "Ultra-High Frequency" quantitative analysis tool designed to bridge the gap between technical charting and AI-assisted trading. It generates the **"QuantScan 9.0"** dataset, a dense CSV report containing over 30 institutional-grade metrics for every asset in your watchlist. -This dataset ("QuantScan 3.0") is optimized for Large Language Models (LLMs) or statistical analysis tools. Instead of raw price data, it provides normalized scores (Z-Score, Efficiency Ratio, Relative Strength), offering deep insights into Trend Quality, Institutional Footprints, and Statistical Reversion risks. +Unlike standard screeners, this tool analyzes the **structure, stability, and statistical anomalies** of the price action, not just simple indicator crossovers. -## 2. Methodology and Logic +## 2. The 3-Layer Fractal Model -The script employs a **Hybrid Analysis Model** with three core layers: +To provide a complete market X-Ray, metrics are calculated across three synchronized timeframes: -1. **Context Layer (H1):** Determines the "Big Picture". It identifies the dominant trend direction, the structural quality of that trend, and correlation with the broader market (Relative Strength). -2. **Trigger Layer (M15):** Analyzes "Execution Timing". It monitors momentum shifts, volatility regimes, and statistical extremes. -3. **Institutional Layer (New):** Detects hidden market mechanics, specifically "Absorption" (high volume vs. low range) and extreme probability of mean reversion. +1. **Layer 1: Context (H1):** Determines the Strategic Direction. Is the market trending or ranging? Is the move efficient? +2. **Layer 2: Flow (M15):** Determines the Tactical State. Is price cheap or expensive (Value)? Is momentum sustaining? +3. **Layer 3: Trigger (M5):** Determines the Execution Timing. Is there immediate velocity and volume support? -### Key Metrics Defined +## 3. The "QuantScan 9.0" Dataset (Column Dictionary) -* **Trend Score (Z-Score & Deviation):** Measures how far the price is from the trend baseline in units of volatility (ATR). -* **Relative Strength (RS):** Compares the asset's performance against a Benchmark (e.g., US500) over the last 24 hours. A positive RS indicates the asset is outperforming the market. -* **Institutional Absorption:** A logical check based on Wyckoff principles. If Volume is extreme (RVOL > 2.0) but Price Movement is small, it indicates passive limit orders absorbing aggressive market orders—often a sign of a reversal. -* **Reversion Probability:** A composite score (0-100%) that combines Z-Score extremes, Murrey Levels, and Momentum Exhaustion to predict a potential pullback. +The CSV output contains the following metrics. Use this legend to interpret the data or guide your LLM. -## 3. MQL5 Implementation Details +### A. Global Sentiment (Header) -The script is built upon the **"Professional Indicator Suite"** architecture, ensuring mathematical precision and performance. +* **Format:** `RISK-ON (US:+0.5% DX:-0.3%)`. +* **Logic:** Compares S&P 500 vs Dollar Index. + * **Risk-On:** Stocks Up, Dollar Down (Bullish for Crypto/EURUSD). + * **Risk-Off:** Stocks Down, Dollar Up (Bearish). -* **Calculation Engines (`.mqh`):** It directly instantiates optimized Calculation Classes (e.g., `CDSMACalculator`, `CVWAPCalculator`) rather than using slow `iCustom` calls. -* **Defensive Programming:** Includes rigorous safety checks (e.g., array bounds checking in ATR) to prevent runtime crashes during large-scale scanning. -* **Smart Data Fetching:** Utilizes efficient `FetchData` wrappers to retrieve and sync OHLCV data for multiple timeframes instantaneously. +### B. Layer 1: H1 Context (Strategy) -## 4. Parameters - -* **Scanner Config:** - * `InpUseMarketWatch`: If `true`, scans all active symbols. - * `InpSymbolList`: Custom symbol list (if using manual selection). - * `InpBenchmark`: The symbol for Relative Strength comparison (Default: `US500`). - * **`InpBrokerTimeZone`**: **NEW!** Your broker's timezone name (e.g. `EET`, `UTC+3`). This string is added to the CSV header so the AI knows the context of the timestamp (crucial for detecting Session Opens/Closes). - * **`InpScanHistory`**: **NEW!** Number of bars to download for analysis (Default: `500`). Increase this if using slow moving averages (200 SMA). -* **Timeframes:** - * `InpTFFast` (Trigger): Default `M15`. - * `InpTFSlow` (Context): Default `H1`. - * **Metric Settings:** - * **`InpRSBars`**: **NEW!** Lookback period for Relative Strength calculation. - * `24 (Default on H1)` = 24 Hours performance. - * `120` = Weekly performance. - * Indicators fine-tuning (DSMA, Gamma, etc). -* **Squeeze Settings:** - * Allows fine-tuning of the Volatility Squeeze sensitivity (`BB Multiplier`, `KC Multiplier`). -* **TSI Settings:** - * Customizable periods for the True Strength Index (Cycle). - -## 5. Output Data Structure (CSV - QuantScan 3.0) - -The script generates a file named `QuantScan_YYYY.MM.DD_HHMM.csv` in the `MQL5\Files` folder. - -| Header | Description | Interpretation / ranges | +| Metric | Full Name | Interpretation | | :--- | :--- | :--- | -| **`TIME`** | Timestamp | `YYYY.MM.DD HH:MM` format. | -| **`SYMBOL`** | Asset Name | e.g., `EURUSD`. | -| **`PRICE`** | Current Bid | The snapshot price at scan time. | -| **`TREND_SCORE`** | **H1 Trend Strength** | Normalized deviation.
• `> +1.0`: Strong Bull
• `< -1.0`: Strong Bear | -| **`TREND_QUAL`** | **H1 Efficiency** | Trend noise filter (Kaufman ER).
• `> 0.6`: Clean Trend (Safe to trade) | -| **`ZONE`** | **H1 Structure** | Murrey Math Level.
• `Extreme`: Reversal zone.
• `Range`: Trading zone. | -| **`REL_STRENGTH`** | **Relative Perf.** | Performance vs Benchmark (24h).
• `> 0%`: Leader (Stronger than market)
• `< 0%`: Laggard (Weaker than market) | -| **`MOMENTUM`** | **M15 Laguerre** | Fast momentum (0.0 - 1.0).
• `> 0.85`: Bullish Pressure (Gamma lag) | -| **`VOL_QUAL`** | **M15 RVOL** | Relative Volume.
• `> 1.5`: High Activity
• `< 0.7`: Low Low Interest | -| **`SQUEEZE`** | **M15 Vola State** | TTM Squeeze status.
• `ON`: Energy building (Prepare for breakout). | -| **`Z_SCORE`** | **M15 Statistics** | Standard Deviations from mean.
• `> 2.5`: Statistically Extreme. | -| **`VOL_REGIME`** | **M15 Vola Trend** | Ratio of Short/Long ATR.
• `> 1.0`: Volatility is expanding. | -| **`TSI_DIR`** | **M15 Cycle** | Cycle direction (`BULL` / `BEAR`). | -| **`REVERSION_PROB`** | **Reversion %** | Composite probability of a pullback.
• `> 80%`: High risk of reversal. | -| **`ABSORPTION`** | **Inst. Volume** | Wyckoff Absorption signal.
• `YES`: High Vol + Small Body (Hidden activity). | +| **ALPHA** | Alpha Excess Return | True performance adjusted for market risk. | +| **BETA** | Beta Sensitivity | `>1.5`: Aggressive/Volatile. `<0.5`: Defensive. | +| **VHF** | **Vertical Horizontal Filter** | Trend Intensity. `>0.40`: Trending. `<0.30`: Ranging. | +| **R2** | **R-Squared** | Trend Linearity. `>0.7`: Perfect straight line. `<0.3`: Random mess. | +| **ZONE** | Market Structure | Murrey Math Level. `Extreme` areas imply reversal risk. | -## 6. Usage Workflow +### C. Layer 2: M15 Flow (Tactics) -1. **Run the Script:** Drag `Market_Scanner_Pro` onto any chart. -2. **Wait for Completion:** Check the "Experts" tab. -3. **Locate File:** Open "File -> Open Data Folder -> MQL5 -> Files". -4. **Process with AI:** Upload the `QuantScan_....csv` file to your LLM with a prompt like: +| Metric | Full Name | Interpretation | +| :--- | :--- | :--- | +| **V_SCORE** | **VWAP Z-Score** | Deviation from VWAP. `>2.0`: Expensive. `< -2.0`: Cheap (Value). | +| **AUTOCORR** | **Lag-1 Autocorrelation** | Regime filter. `>0`: Momentum. `<0`: Mean Reversion (Ping-pong). | +| **VOL_REGIME** | Volatility Regime | `>1.0`: Expansion (Impulse). `<1.0`: Contraction (Rest). | +| **SQZ** | Volatility Squeeze | `ON`: Potential explosive move building up. | +| **SQZ_MOM** | Squeeze Momentum | Direction and strength of the potential breakout. | +| **VHF** | **Vertical Horizontal Filter** | Trend Intensity. `>0.40`: Trending. `<0.30`: Ranging. | +| **R2** | **R-Squared** | Trend Linearity. `>0.7`: Perfect straight line. `<0.3`: Random mess. | +| **DIST_PDH/L** | Distance Prev High/Low | Space to key daily levels (ATR units). | - > *"Analyze this market data. Look for two specific setups:* - > - > 1. ***The Whale Utility:** Strong Trend (`TREND_SCORE > 0.5`) + Strong Relative Strength (`REL_STRENGTH > 0`) + Squeeze is `ON`. - > 2. ***The Reversion Trap:** High Reversion Probability (`> 80%`) AND Absorption is `YES`. - > - > *List the top 3 candidates for each."* +### D. Layer 3: M5 Trigger (Execution) + +| Metric | Full Name | Interpretation | +| :--- | :--- | :--- | +| **VEL** | **velocity** | Signed Speed. `>1.0`: Fast Rally. `<-1.0`: Fast Drop. | +| **VOL_THRUST** | Volume Thrust | Ratio of M5/M15 RVOL. `>1.5`: Accelerating volume. | +| **COST_ATR** | Spread Cost | `>0.3`: Expensive spread (Low liquidity). | + +### E. Composites (Decision Support) + +| Metric | Full Name | Interpretation | +| :--- | :--- | :--- | +| **ABSORPTION** | Institutional Absorption | `YES`: High Volume + Small Candle = Hidden Reversal. | +| **MTF_ALIGN** | Timeframe Alignment | `FULL_BULL` = H1, M15, and M5 cycles agree. High probability. | + +## 4. How to Analyze (LLM Prompts) + +### **Scenario 1: The "Unstoppable Trend"** +> +> *"Find assets where `R2_H1 > 0.7` AND `VHF_H1 > 0.4` (Strong Linear Trend). Ensure `MTF_ALIGN` is FULL_BULL and `M15_AUTOCORR` is positive (Momentum regime)."* + +### **Scenario 2: The "Value Reversal"** +> +> *"Find assets where `V_SCORE_M15 < -2.0` (Cheap vs VWAP) AND `REV_PROB > 70%`. Check if `ABSORPTION` is YES."* + +### **Scenario 3: The "Squeeze Breakout"** +> +> *"Find assets where `SQZ_M15` is ON (or recently broke out) AND `VEL_M5` is spiking (>1.0) with High `RVOL`."*