$npx -y skills add kecoma1/MQL5-SKILLS --skill run-backtestsUse when running MetaTrader 5 Strategy Tester backtests from the terminal in this workspace. Ask the user for the test configuration field by field before launching the test, using the current project defaults unless the user changes them.
| 1 | # Run Backtests |
| 2 | |
| 3 | Use this skill when the user wants to run a MetaTrader 5 backtest from the terminal. |
| 4 | |
| 5 | ## Command |
| 6 | |
| 7 | Run the main MetaTrader 5 installation with a tester `.ini` file: |
| 8 | |
| 9 | ```powershell |
| 10 | Start-Process -FilePath 'C:\Program Files\MetaTrader 5\terminal64.exe' -ArgumentList '/config:C:\Users\<user>\AppData\Roaming\MetaQuotes\Terminal\<terminal-id>\config\codex-fvgtrader-gbpusd-lastmonth-v2.ini' -Wait |
| 11 | ``` |
| 12 | |
| 13 | Use that command pattern for backtests in this workspace. |
| 14 | |
| 15 | ## Required Workflow |
| 16 | |
| 17 | Before running the test, ask the user for the configuration field by field. |
| 18 | Do not assume the final setup without confirming each field first. |
| 19 | When asking for a field, use JSON Schema style notation like this: |
| 20 | |
| 21 | ```json |
| 22 | { |
| 23 | "type": "object", |
| 24 | "properties": { |
| 25 | "risk_level": { |
| 26 | "type": "string", |
| 27 | "description": "Select your preferred risk level", |
| 28 | "enum": ["low", "medium", "high"] |
| 29 | } |
| 30 | }, |
| 31 | "required": ["risk_level"] |
| 32 | } |
| 33 | ``` |
| 34 | |
| 35 | Use the same notation for backtest questions. Add `enum` options whenever the field has a bounded set of valid choices. |
| 36 | |
| 37 | Ask in this order: |
| 38 | |
| 39 | 1. Expert or strategy file. |
| 40 | 2. Symbol. |
| 41 | 3. Timeframe. |
| 42 | 4. Date range. |
| 43 | 5. Deposit. |
| 44 | 6. Deposit currency. |
| 45 | 7. Leverage. |
| 46 | 8. Tick model. |
| 47 | 9. Optimization on or off. |
| 48 | 10. Visualization on or off. |
| 49 | |
| 50 | Use these question shapes: |
| 51 | |
| 52 | 1. Expert or strategy file: |
| 53 | |
| 54 | ```json |
| 55 | { |
| 56 | "type": "object", |
| 57 | "properties": { |
| 58 | "expert": { |
| 59 | "type": "string", |
| 60 | "description": "Select the Expert Advisor or strategy file to run", |
| 61 | "enum": ["Experts\\\\codex\\\\FVGTrader.ex5"] |
| 62 | } |
| 63 | }, |
| 64 | "required": ["expert"] |
| 65 | } |
| 66 | ``` |
| 67 | |
| 68 | 2. Symbol: |
| 69 | |
| 70 | ```json |
| 71 | { |
| 72 | "type": "object", |
| 73 | "properties": { |
| 74 | "symbol": { |
| 75 | "type": "string", |
| 76 | "description": "Select the symbol to backtest", |
| 77 | "enum": ["GBPUSD"] |
| 78 | } |
| 79 | }, |
| 80 | "required": ["symbol"] |
| 81 | } |
| 82 | ``` |
| 83 | |
| 84 | 3. Timeframe: |
| 85 | |
| 86 | ```json |
| 87 | { |
| 88 | "type": "object", |
| 89 | "properties": { |
| 90 | "timeframe": { |
| 91 | "type": "string", |
| 92 | "description": "Select the chart timeframe", |
| 93 | "enum": ["M1", "M5", "M15", "M30", "H1", "H4", "D1"] |
| 94 | } |
| 95 | }, |
| 96 | "required": ["timeframe"] |
| 97 | } |
| 98 | ``` |
| 99 | |
| 100 | 4. Date range: |
| 101 | |
| 102 | ```json |
| 103 | { |
| 104 | "type": "object", |
| 105 | "properties": { |
| 106 | "date_range": { |
| 107 | "type": "string", |
| 108 | "description": "Select the date range preset or provide a custom range", |
| 109 | "enum": ["last_week", "last_month", "last_3_months", "custom"] |
| 110 | } |
| 111 | }, |
| 112 | "required": ["date_range"] |
| 113 | } |
| 114 | ``` |
| 115 | |
| 116 | 5. Deposit: |
| 117 | |
| 118 | ```json |
| 119 | { |
| 120 | "type": "object", |
| 121 | "properties": { |
| 122 | "deposit": { |
| 123 | "type": "number", |
| 124 | "description": "Enter the starting deposit amount" |
| 125 | } |
| 126 | }, |
| 127 | "required": ["deposit"] |
| 128 | } |
| 129 | ``` |
| 130 | |
| 131 | 6. Deposit currency: |
| 132 | |
| 133 | ```json |
| 134 | { |
| 135 | "type": "object", |
| 136 | "properties": { |
| 137 | "currency": { |
| 138 | "type": "string", |
| 139 | "description": "Select the deposit currency", |
| 140 | "enum": ["USD", "EUR", "GBP"] |
| 141 | } |
| 142 | }, |
| 143 | "required": ["currency"] |
| 144 | } |
| 145 | ``` |
| 146 | |
| 147 | 7. Leverage: |
| 148 | |
| 149 | ```json |
| 150 | { |
| 151 | "type": "object", |
| 152 | "properties": { |
| 153 | "leverage": { |
| 154 | "type": "string", |
| 155 | "description": "Select the leverage", |
| 156 | "enum": ["1:30", "1:50", "1:100", "1:200", "1:500"] |
| 157 | } |
| 158 | }, |
| 159 | "required": ["leverage"] |
| 160 | } |
| 161 | ``` |
| 162 | |
| 163 | 8. Tick model: |
| 164 | |
| 165 | ```json |
| 166 | { |
| 167 | "type": "object", |
| 168 | "properties": { |
| 169 | "tick_model": { |
| 170 | "type": "string", |
| 171 | "description": "Select the tick generation model", |
| 172 | "enum": ["open_prices", "control_points", "every_tick", "real_ticks"] |
| 173 | } |
| 174 | }, |
| 175 | "required": ["tick_model"] |
| 176 | } |
| 177 | ``` |
| 178 | |
| 179 | 9. Optimization on or off: |
| 180 | |
| 181 | ```json |
| 182 | { |
| 183 | "type": "object", |
| 184 | "properties": { |
| 185 | "optimization": { |
| 186 | "type": "string", |
| 187 | "description": "Select whether optimization is enabled", |
| 188 | "enum": ["off", "on"] |
| 189 | } |
| 190 | }, |
| 191 | "required": ["optimization"] |
| 192 | } |
| 193 | ``` |
| 194 | |
| 195 | 10. Visualization on or off: |
| 196 | |
| 197 | ```json |
| 198 | { |
| 199 | "type": "object", |
| 200 | "properties": { |
| 201 | "visualization": { |
| 202 | "type": "string", |
| 203 | "description": "Select whether visualization is enabled", |
| 204 | "enum": ["off", "on"] |
| 205 | } |
| 206 | }, |
| 207 | "required": ["visualization"] |
| 208 | } |
| 209 | ``` |
| 210 | |
| 211 | ## Defaults |
| 212 | |
| 213 | Use these values as defaults unless the user changes them: |
| 214 | |
| 215 | 1. Expert: `Experts\codex\FVGTrader.ex5` |
| 216 | 2. Symbol: `GBPUSD` |
| 217 | 3. Timeframe: `M15` |
| 218 | 4. Date range: last month |
| 219 | 5. Deposit: `100000` |
| 220 | 6. Currency: `USD` |
| 221 | 7. Leverage: `1:100` |
| 222 | 8. Tick model: real ticks |
| 223 | 9. Optimization: off |
| 224 | 10. Visualization: off |
| 225 | |
| 226 | ## Tester INI |
| 227 | |
| 228 | Create or update a tester `.ini` with the confirmed values. |
| 229 | |
| 230 | Use this structure: |
| 231 | |
| 232 | ```ini |
| 233 | [Tester] |
| 234 | Expert=<ask_user_expert> |
| 235 | Symbol=GBPUSD |
| 236 | Period=M15 |
| 237 | Model=4 |
| 238 | Optimization=0 |
| 239 | FromDate=2026.02.28 |
| 240 | ToDate=2026.03.28 |
| 241 | ForwardMode=0 |
| 242 | Deposit=100000 |
| 243 | Currency=USD |
| 244 | Leverage=1:100 |
| 245 | ExecutionMode=0 |
| 246 | Visual=0 |
| 247 | Report=<ask_user_report> |
| 248 | ReplaceReport=1 |
| 249 | ShutdownTerminal=1 |
| 250 | UseLocal=1 |
| 251 | UseRemote=0 |
| 252 | UseCloud=0 |
| 253 | ``` |
| 254 | |
| 255 | ## Validation |
| 256 | |
| 257 | After launching the test: |
| 258 | |
| 259 | 1. Read the tester logs. |
| 260 | 2. Confirm the backtest really started. |
| 261 | 3. Conf |