Watch how to download trading robots for free
Find us on Twitter!
Join our fan page
Interesting script?
So post a link to it -
let others appraise it
You liked the script? Try it in the MetaTrader 5 terminal
Libraries

Simple License - lock your EA to accounts, expiry date, demo-only or server - library for MetaTrader 5

Augusto Martin D'anna
Augusto Martin D'anna
MQL5 & Pine Script developer | Trader since 2019 | Strategy validation
As a trader, I know a bot is only as good as the logic behind it. I bridge
trading concepts and clean code: I don't just follow instructions, I make
sure your EA behaves exactly the way your strategy intends.
Views:
61
Rating:
(1)
Published:
MQL5 Freelance Need a robot or indicator based on this code? Order it on Freelance Go to Freelance

SimpleLicense.mqh is a small include file to protect EAs and indicators you sell or share privately. You set the allowed accounts and the expiry date, compile, and give your customer only the .ex5. If the account, date, account type or server do not match, the program shows the reason and its logic does not run.

What it checks

  • Allowed accounts - a comma-separated list of account numbers (empty = any account).
  • Expiry date - the program stops working after this date (0 = never).
  • Demo only - useful for trial versions: it refuses to run on real accounts.
  • Server filter - part of the broker server name, e.g. "FTMO" (empty = any server).

The check runs in OnInit and again once per hour (once per minute while invalid), so an expiry date or an account switch is detected without restarting the terminal. The alert with the reason is shown once, not on every tick.

How to use it

  • Copy SimpleLicense.mqh next to your EA (or into MQL5\Include) and add #include "SimpleLicense.mqh".
  • Declare CSimpleLicense lic; and in OnInit call AllowAccounts(), SetExpiry(), DemoOnly() and AllowServer() as needed, then if(!lic.Check()) return INIT_FAILED;
  • At the start of OnTick (or OnCalculate) add if(!lic.IsValid()) return;
  • LicenseDemoEA.mq5 shows the complete pattern: edit the four #define lines per customer and compile.

Limits

  • The values are compiled into the .ex5, so you build one file per customer and never share the source.
  • This stops casual sharing between traders. It is not protection against a determined cracker; for paid products with automatic licensing, the MQL5 Market is the stronger option.
  • Checks use the terminal's account information and server time.
Prop Firm Guardian - daily loss, max loss and profit target lock Prop Firm Guardian - daily loss, max loss and profit target lock

Account guardian for prop firm rules: closes all trades and blocks trading before the daily loss or max loss limit is hit, with an optional profit target lock.

Trade Permission Checker - finds why an EA or copier cannot trade Trade Permission Checker - finds why an EA or copier cannot trade

Finds out why an EA or trade copier cannot trade on your account. Read-only script, never trades.

Equity Target Closer - close all trades at a profit or loss level Equity Target Closer - close all trades at a profit or loss level

Closes all positions and pending orders when the account profit or loss reaches your target, in money or % of balance. Floating or full-day P/L, symbol and magic filters.

Execution Quality Logger - slippage, fill delay and spread of every deal Execution Quality Logger - slippage, fill delay and spread of every deal

Logs the slippage, fill delay and spread of every deal on the account (manual, EAs, SL/TP hits) to a CSV file and shows a live summary. It never trades.