$npx -y skills add kecoma1/MQL5-SKILLS --skill analyzeAnalyze market regime and session structure in this MQL5 workspace using reusable CSV exports from an MQL5 script. Use when Codex needs to classify a market as Tendencial or Lateral with moving average and ATR, export per-session data to Terminal Common Files for M15, H1, and D1,
| 1 | # Analyze |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Use this skill to analyze markets by session in this workspace. |
| 6 | |
| 7 | Keep the workflow simple: |
| 8 | - export CSV data with the MQL5 script |
| 9 | - read the CSV directly |
| 10 | - answer the user from the exported data |
| 11 | |
| 12 | Do not create HTML reports. |
| 13 | Do not rely on Python for this workflow. |
| 14 | |
| 15 | ## Reusable files |
| 16 | |
| 17 | Use these files as the primary workflow: |
| 18 | |
| 19 | - `Scripts\codex\SessionMarketExporter.mq5` |
| 20 | - `Presets\SessionMarketExporter-<SYMBOL>-lastyear.set` |
| 21 | - `config\session-market-exporter-<symbol>-lastyear.ini` |
| 22 | |
| 23 | Do not recreate them on each request. Reuse them and only update them when the export logic is actually wrong. |
| 24 | |
| 25 | ## Goal |
| 26 | |
| 27 | Produce session-level market analysis for `M15`, `H1`, and `D1` with: |
| 28 | |
| 29 | - Session name |
| 30 | - Moving average context |
| 31 | - ATR context |
| 32 | - Market type: `Tendencial` or `Lateral` |
| 33 | - Trend direction |
| 34 | - Session volatility |
| 35 | - Session insights |
| 36 | - Session recommendations |
| 37 | |
| 38 | ## Export workflow |
| 39 | |
| 40 | 1. Compile `Scripts\codex\SessionMarketExporter.mq5`. |
| 41 | 2. Create or update a script preset under `MQL5\Presets\` with plain script values. |
| 42 | 3. Create or update a startup `.ini` under `MQL5\config\` using `[StartUp] Script=...`. |
| 43 | 4. Close any running `terminal64.exe` before launching. |
| 44 | 5. Launch MT5 with `/config:...`. |
| 45 | 6. Export CSV files into `Terminal\Common\Files\`. |
| 46 | 7. Read the generated CSV files directly and summarize them for the user. |
| 47 | |
| 48 | ## Script preset rule |
| 49 | |
| 50 | For `ScriptParameters`, use a normal script preset with simple `key=value` lines. |
| 51 | |
| 52 | Correct example: |
| 53 | |
| 54 | ```ini |
| 55 | InpSymbol=EURUSD |
| 56 | InpLookbackDays=365 |
| 57 | InpMAPeriod=20 |
| 58 | InpMAMethod=0 |
| 59 | InpATRPeriod=14 |
| 60 | InpTrendSlopeAtrRatio=0.15 |
| 61 | InpTrendDistanceAtrRatio=0.20 |
| 62 | InpOutputPrefix=session_market |
| 63 | ``` |
| 64 | |
| 65 | Do not use the optimization format `value||start||step||stop||selected` in a script preset. That format is for optimization, not for scripts. |
| 66 | |
| 67 | ## Startup ini pattern |
| 68 | |
| 69 | Use this structure: |
| 70 | |
| 71 | ```ini |
| 72 | [Common] |
| 73 | Login=4000030114 |
| 74 | |
| 75 | [Experts] |
| 76 | Enabled=1 |
| 77 | |
| 78 | [StartUp] |
| 79 | Symbol=EURUSD |
| 80 | Period=M15 |
| 81 | Script=codex\SessionMarketExporter |
| 82 | ScriptParameters=SessionMarketExporter-EURUSD-lastyear.set |
| 83 | ShutdownTerminal=1 |
| 84 | ``` |
| 85 | |
| 86 | The `Script=` path is relative to `MQL5\Scripts\`. |
| 87 | The `ScriptParameters=` file is loaded from `MQL5\Presets\`. |
| 88 | |
| 89 | ## Exported CSV files |
| 90 | |
| 91 | Expect one CSV per timeframe: |
| 92 | |
| 93 | - `session_market_<SYMBOL>_M15.csv` |
| 94 | - `session_market_<SYMBOL>_H1.csv` |
| 95 | - `session_market_<SYMBOL>_D1.csv` |
| 96 | |
| 97 | In this workspace they are currently exported directly under: |
| 98 | |
| 99 | - `C:\Users\user-id\AppData\Roaming\MetaQuotes\Terminal\Common\Files\` |
| 100 | |
| 101 | ## CSV expectations |
| 102 | |
| 103 | The exported CSV should include fields like: |
| 104 | |
| 105 | - `session` |
| 106 | - `ma_value` |
| 107 | - `ma_slope_points` |
| 108 | - `atr_points` |
| 109 | - `distance_to_ma_points` |
| 110 | - `trend_direction` |
| 111 | - `market_type` |
| 112 | - `trend_score` |
| 113 | |
| 114 | Treat these CSV files as the source of truth. |
| 115 | |
| 116 | ## Session model |
| 117 | |
| 118 | Use these session buckets for intraday analysis: |
| 119 | |
| 120 | - `Asia`: 00:00-08:00 |
| 121 | - `London`: 08:00-16:00 |
| 122 | - `NewYork`: 16:00-24:00 |
| 123 | |
| 124 | For `D1`, use a single `Daily` session. |
| 125 | |
| 126 | Treat these windows as UTC unless the script or user explicitly changes them. |
| 127 | |
| 128 | ## Interpretation rules |
| 129 | |
| 130 | - `Tendencial`: moving average slope and price-vs-MA distance are large enough relative to ATR. |
| 131 | - `Lateral`: MA slope and distance-to-MA do not show directional expansion versus ATR. |
| 132 | - `Volatilidad Alta`: current ATR is materially above the session median. |
| 133 | - `Volatilidad Baja`: current ATR is materially below the session median. |
| 134 | |
| 135 | Use the exported values directly. Do not invent extra indicators that are not in the CSV. |
| 136 | |
| 137 | ## Final analysis format |
| 138 | |
| 139 | When answering the user, summarize: |
| 140 | |
| 141 | - the current regime for each timeframe |
| 142 | - the regime by session |
| 143 | - the volatility by session |
| 144 | - practical recommendations by session |
| 145 | - any cross-timeframe alignment or conflict |
| 146 | |
| 147 | Keep the tone analytical and concise. |
| 148 | |
| 149 | ## Example commands |
| 150 | |
| 151 | Compile: |
| 152 | |
| 153 | ```powershell |
| 154 | & 'C:\Program Files\MetaTrader 5\MetaEditor64.exe' /compile:'C:\Users\user-id\AppData\Roaming\MetaQuotes\Terminal\<terminal-id>\MQL5\Scripts\codex\SessionMarketExporter.mq5' /log:'C:\Users\user-id\AppData\Roaming\MetaQuotes\Terminal\<terminal-id>\MQL5\Logs\session-market-exporter-compile.log' |
| 155 | ``` |
| 156 | |
| 157 | Run the exporter: |
| 158 | |
| 159 | ```powershell |
| 160 | Get-Process terminal64 -ErrorAction SilentlyContinue | Stop-Process -Force |
| 161 | Start-Sleep -Seconds 2 |
| 162 | Start-Process -FilePath 'C:\Program Files\MetaTrader 5\terminal64.exe' -ArgumentList '/config:C:\Users\user-id\AppData\Roaming\MetaQuotes\Terminal\<terminal-id>\MQL5\config\session-market-exporter-eurusd-lastyear.ini' -Wait |
| 163 | ``` |
| 164 | |
| 165 | ## Validated paths in this workspace |
| 166 | |
| 167 | - `C:\Users\user-id\AppData\Roaming\MetaQuotes\Terminal\Common\Files\session_market_EURUSD_M15.csv` |
| 168 | - `C:\Use |