Guarda come scaricare robot di trading gratuitamente
Ci trovi su Telegram!
Unisciti alla nostra fan page
Script interessante?
Pubblica il link!
lasciare che altri lo valutino
Ti è piaciuto lo script? Provalo nel Terminale MetaTrader 5
Librerie

EA Validation Guard - Pre-Trade Request Checker - libreria per MetaTrader 5

Luke John Smith
Luke John Smith
I’m a full-time MQL5 developer.
I build Expert Advisors, indicators, dashboards and trading tools for traders who want real automation — not theory.
I specialise in turning manual trading strategies into clean, stable and fully automated systems that can run reliably in real market conditions.
Visualizzazioni:
39
Pubblicato:
Aggiornato:
Freelance MQL5 Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance

EA Validation Guard is a reusable MQL5 include designed to perform pre-trade checks before an Expert Advisor sends an order to the broker.

Its purpose is to help developers detect common execution problems before calling OrderSend(), while providing a clear journal message explaining why a trade request was rejected.

The library does not contain any trading strategy and does not open trades automatically.

Main checks

  • Terminal trading permission.

  • Expert Advisor trading permission.

  • Account trading permission.

  • Symbol trading mode.

  • Trading session availability.

  • Minimum trade volume.

  • Maximum trade volume.

  • Volume step validation.

  • SYMBOL_VOLUME_LIMIT.

  • Entry price tick-size alignment.

  • Stop loss tick-size alignment.

  • Take profit tick-size alignment.

  • Broker minimum stop distance.

  • Margin requirement estimation.

  • Available free margin.

  • Broker OrderCheck validation.

  • Stop level and freeze level information in rejection diagnostics.





Basic usage

Include the library:

#include <MQLXpert_ValidationGuard.mqh>

Create your normal MqlTradeRequest and pass it to:

MQLXpertValidateTradeRequest()

If validation succeeds, the request can then be passed to OrderSend().

If validation fails, the function returns false and provides a readable reason explaining why the request was blocked.

Example

The included example script demonstrates how to construct a market trade request and pass it through the validation library.

For safety, the example performs validation only and intentionally does not send a live trade.

Purpose

This library is intended for Expert Advisor developers who want an additional pre-flight validation layer before sending trade requests.

It can be useful when developing EAs for different brokers, symbols and account types where margin requirements, volume limits, stop restrictions and trading permissions may vary.


Developed by MQLXpert

Code for Traders. By Traders.


Prop Firm Daily Profit Lock Prop Firm Daily Profit Lock

Daily Profit Lock is a free utility EA that protects a good trading day. Once today's profit hits your cap, it closes your trades, deletes pending orders and blocks new trades until the next day. You can set the cap as a fixed amount, a percent of balance, or a share of total profit, which suits prop-firm consistency rules. Dry run is on by default, so it only alerts until you're ready, and it never opens a trade itself.

One-Click Buy Sell Close Panel with Pip Stops One-Click Buy Sell Close Panel with Pip Stops

Chart panel Expert Advisor with BUY, SELL and CLOSE buttons. Market orders use a fixed lot with stop loss and take profit in pips, and the panel shows the floating profit of its trades.

Round Number Levels Round Number Levels

Auto-scaled round-number (psychological) levels with major, half and quarter lines, plus a panel showing the nearest levels and their distance in price, points and % of daily ATR.

Psychological Level Reaction Tracker Psychological Level Reaction Tracker

Free MQL5 indicator that plots 00, 25, 50 and 75 psychological price levels and tracks historical touches, rejections, breakouts and sweeps with dashboard statistics and alerts.