당사 팬 페이지에 가입하십시오
Trade Environment Check: account mode, symbol trading rules and open positions in one report - MetaTrader 5용 스크립트
- 조회수:
- 63
- 게시됨:
-
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동
Many "the EA does not work" cases are not bugs in the EA at all: AutoTrading is off, the account is netting while the robot expects hedging, the broker rejects the filling mode, a stop sits inside the stops level, or the lot is not a multiple of the volume step. TradeEnvCheck is a script that collects all of that in one report, so you can see it before you install a robot, and so a developer can see it before writing one.
Run it once on a chart of the symbol you care about. It prints the report to the Experts log, shows a short summary on the chart and saves the full text as MQL5\Files\TradeEnvCheck_<symbol>.txt. The script only reads account, symbol, position and order information; it never trades, modifies or closes anything.
What the report contains
Account
- server, company, currency, leverage, account type (demo, contest, real);
- margin mode, with a one-line explanation: hedging (several positions per symbol, each with its own SL and TP) or netting (one net position per symbol, opposite deals reduce or reverse it);
- the four trading permissions that all have to be on: account, Expert Advisors on the account, AutoTrading in the terminal, and the program itself;
- margin call and stop out levels.
Symbol
- trade mode (full, long only, short only, close only, disabled), execution mode (Market, Instant, Request, Exchange), profit calculation mode;
- digits, point, tick size, tick value, contract size;
- the filling modes the symbol accepts and the one to use in OrderSend, chosen the same way CTrade::SetTypeFillingBySymbol does;
- allowed order types (market, limit, stop, stop-limit, SL, TP, close-by) and expiration modes;
- stops level, freeze level and the current spread;
- minimum, step, maximum and per-symbol volume limit;
- swap mode, long and short swap, the triple-swap day;
- on hedging accounts, the hedged margin rate.
Open on the symbol
- the number of positions, their total long and short volume and the number of pending orders;
- one line per position and order with ticket, type, volume, open price, SL, TP and magic number.
Checklist: what an Expert Advisor must handle here
A list of [OK], [NOTE] and [WARN] lines written in plain words, for example:
- hedging: close, modify and count positions by ticket, because PositionSelect(symbol) returns only one of them; a warning if several positions are already open;
- netting: at most one position per symbol, SL and TP belong to the net position;
- which permission is missing, if any;
- the filling type to send, and the error code you get with the wrong one (10030);
- how far stops must be from the price (10016) and what the freeze level blocks;
- the volume rules (10014) and the volume limit;
- what the execution mode means for the price in a request and for requotes;
- the swap you pay or earn overnight.
An excerpt of the report from a demo hedging account, XAUUSD:
Margin mode: HEDGING - several positions may be open on one symbol at the same time, each with its own Stop Loss and Take Profit Trading allowed: account yes, Expert Advisors on this account yes, terminal AutoTrading off, this program no Filling modes allowed: FOK IOC -> use ORDER_FILLING_FOK (the same choice CTrade::SetTypeFillingBySymbol makes) Stops level 0 points, freeze level 0 points, spread now 25 points Volume: min 0.01, step 0.01, max 100.00, limit per symbol none --- What an Expert Advisor must handle here --- [NOTE] Hedging account: close, modify and count positions by ticket (PositionGetTicket / PositionSelectByTicket). PositionSelect("XAUUSD") returns only one of the positions on the symbol. [WARN] AutoTrading is switched off in the terminal: no EA can trade until it is turned on. [NOTE] Send market orders with ORDER_FILLING_FOK; a filling type the symbol does not allow is rejected with 'Unsupported filling mode' (10030). [NOTE] Lots must be between 0.01 and 100.00 in steps of 0.01; normalise the volume before sending or the request fails with 'Invalid volume' (10014).
The screenshot shows the on-chart summary of the same run; the full report goes to the Experts log and to the text file.

Inputs
- Show the summary on the chart (Comment).
- List open positions and pending orders on this symbol.
- Save the report to MQL5\Files\TradeEnvCheck_<symbol>.txt.
- Hide the account number in the report (on by default, so the file can be shared).
Typical use
- Before ordering a robot on Freelance, run the script on the symbol and attach the text file to the order: the developer then knows whether the account is hedging or netting, which filling mode the broker takes and what the stop and volume rules are.
- Before installing an EA on a new broker, run it and compare the checklist with what the EA assumes.
- When an EA reports 10030, 10016 or 10014, run it and read the matching line.
Compiled with MetaTrader 5 build 6182, 0 errors and 0 warnings.
Extreme Price Filter
An indicator to reveal the the time candles breached an extreme price boundary
ICT Model Tracker - Sweep, MSS and FVG Setups with Honest Statistics
Detects the ICT model on closed bars (killzone liquidity sweep, MSS with displacement or inverted FVG, retrace entry with SL and TP) and follows every setup to its result with worst-case statistics. It never trades and never repaints; EA-ready buffers.
Opening Gap Tracker: daily and weekend gaps with fill tracking, alerts and a CSV log
Marks daily and weekend opening gaps on any chart, tracks when each gap is filled, alerts on new gaps, logs one CSV line per gap and exposes the gap to iCustom.
Order Watchdog - alerts on unknown magic, duplicates, no SL, stop outs (read-only)
Read-only watchdog for MT5: alerts on unknown magic numbers, duplicate positions after reconnects, missing SL, stop outs and what happened while it was off. Never trades.