Market Validation Inspector
- Utilità
-
Jorge Eliecer Valencia Ferreira
🤖 Quantitative Developer & Algorithmic Trading Specialist | MQL5 & Python
Welcome to my official MQL5 profile. I am a Quantitative Developer and Algorithmic Trader focused on creating high-quality, institutionally robust Expert Advisors with strict risk management. - Versione: 1.0
- Attivazioni: 10
Market Validation Inspector reads the broker specification of a symbol and compares it with the settings your Expert Advisor uses: lot size, stop loss distance, take profit distance and risk per trade. It marks each check as OK, WARN or FAIL, so you can see which symbols and conditions are likely to cause trade errors before you upload an EA to the Market.
It is for developers who prepare EAs for the Market. The automatic validation runs the EA on several symbols and rejects it on trading errors such as invalid volume, invalid stops, volume limit reached, failed modify or market closed. Most of these come from the symbol specification, not from the strategy. This indicator shows that specification next to your numbers.
It is an indicator. It does not open, close or modify any trade.
What it checks
- Trade mode: FAIL if new deals are disabled or the symbol is close-only. WARN if it is buy-only or sell-only.
- Volume: your test lot against minimum, maximum and step. FAIL if the lot is below the minimum, above the maximum or not a multiple of the step. The message shows the lot rounded down to the step.
- Volume limit: if the symbol has a limit per direction, it counts your open positions and pending orders in that direction and shows the room left. FAIL if the test lot does not fit. WARN otherwise, as a reminder to cap every order.
- Stops: your SL and TP distance against the stops level, the freeze level and the current spread. FAIL below the server minimum. WARN below a safer distance (twice the spread plus 10%), because the minimum can grow when the spread widens. If the broker reports a stops level of 0, the level is floating and the spread is used.
- Freeze level: WARN if it is above 0, because SL/TP closer than that to the price cannot be modified.
- Tick size: WARN if it differs from the point, as a reminder to round prices to the tick size.
- Filling: shows FOK, IOC and RETURN as the symbol allows them. WARN if FOK is not available, because CTrade sends FOK unless you set the filling type.
- Session: today's trade sessions in server time. WARN if the market is closed now or if there is a break during the day. If a symbol publishes no sessions at all, it is treated as always open.
- Margin: estimated margin for the test lot, compared with your free margin. FAIL if it exceeds free margin. WARN above half of it.
- Risk sizing: lots you would get for your risk % of equity at your SL distance, rounded down to the step. WARN if the result is below the minimum lot.
- Currency: INFO line when the profit currency differs from the account currency.
What it scans
The symbol of the chart, a EURUSD symbol, and optionally every symbol in the Market Watch. For EURUSD it takes the first symbol whose name starts with "EURUSD" and has full trade mode, and falls back to the first one it finds. Brokers often list a disabled EURUSD next to a tradable variant such as EURUSD.m. The chart symbol and EURUSD are marked with an asterisk in the panel, because the Market validation runs on both.
How to use it
- Attach it to any chart.
- Set the lot, SL, TP and risk % your EA uses by default.
- Read the panel. Press Rescan to scan again after you change the Market Watch or the inputs.
- Open the CSV for the full list.
Inputs
Settings your Expert Advisor uses
- InpLots (default 0.10): fixed lot to test. 0 = skip.
- InpSlPoints (default 200): stop loss distance in points. 0 = none.
- InpTpPoints (default 400): take profit distance in points. 0 = none.
- InpRiskPercent (default 1.0): risk per trade, % of equity. 0 = skip.
Scan
- InpScanAll (default true): scan all Market Watch symbols.
- InpWriteCsv (default true): save the report to MQL5\Files.
Panel
- InpX (default 10) and InpY (default 25): panel offset in pixels.
- InpFontSize (default 9): font size, from 6 to 20.
- InpColorOk, InpColorWarn, InpColorFail, InpColorText, InpColorBack: panel colors.
Negative values, a risk above 100 or a font size outside 6 to 20 stop the indicator at start with an error in the Experts log.
Output
Panel on the chart: the account server, margin mode (hedging, netting or exchange), account currency and equity; the test settings; every check for the chart symbol with its level; then a scan summary. The summary lists the chart symbol and EURUSD first, then up to 8 more symbols, worst first, each with its number of FAIL and WARN. The rest are in the CSV. The chart symbol checks refresh every 5 seconds. The full scan runs at start and when you press Rescan.
CSV file: MQL5\Files\MarketValidationInspector.csv. It is rewritten on each scan. Semicolon separated, one row per check, with these columns: symbol; check; level; detail. Level is OK, INFO, WARN or FAIL.
Limitations
- The margin is an estimate. Indicators cannot call OrderCalcMargin, so the value is calculated from the symbol's margin calculation mode, contract size, account leverage and margin rate. It covers forex, CFD, CFD leverage and CFD index modes, and other modes only when the symbol publishes a fixed initial margin. Otherwise the line is INFO and the advice is to call OrderCheck before every order in your EA.
- It checks the specification and the account state at the moment of the scan. Spread, free margin, open positions and trade sessions change, so the result can change too.
- It does not run your EA and it does not replace the Market validation or the Strategy Tester. A clean report does not mean a product will pass.
- The risk sizing check uses a buy order at the current price.
- It needs a price for the symbol. If the market is closed and no quote is available, some checks may show INFO or WARN.
Notes
- Works on any symbol and any timeframe.
- It does not remove symbols from the Market Watch. If the EURUSD symbol it finds is not in your Market Watch, it is selected so its data can be read.
- In the Strategy Tester it checks only the chart symbol, writes no CSV, and shows the panel in visual mode only.
- It uses the broker data of the account it runs on. Run it on the account type you will test with, since specifications differ between brokers and account types.
Risk warning: this tool analyses symbol specifications. It is not trading advice, it does not generate signals and it does not predict results.
