• Skip to primary navigation
  • Skip to main content
  • Skip to footer
barmenteros FX logo

MetaTrader Programming Services | Programmers for MT4, MQL4, MT5, MQL5, Expert Advisor EA, Forex robots, Algo Trading | barmenteros FX

No matter if you need an MT4 programmer, EA programmer, Forex programmer, or MQL programmer. We are the best qualified team to develop your forex trading strategy. Highly skilled in MT4 programming, Expert Advisor EA programming, Forex programming, and MQL4 programming.

  • Home
  • Blog
  • Services
    • MT4 Programmers
    • MT5 Programmers
    • EA programming
    • Forex Programming
    • MQL4 Programming
    • MQL5 Programming
    • MetaTrader 4/5 License Management
    • EA Debugging and Code Review
  • Products
    • My Account
    • LicenseShield – MT4/MT5 License Protection
    • Latest Offers
    • MT4 Indicators
    • MT5 Indicators
  • Request Quote
  • Show Search
Hide Search
Home/Blog/Add License Verification to Your EA in 10 Minutes | MQL4/MQL5 Tutorial
License verification system for an MT4 and MT5 Expert Advisor using security checks

Add License Verification to Your EA in 10 Minutes | MQL4/MQL5 Tutorial

Want to protect your Expert Advisor from unauthorized use? This tutorial shows you exactly how to add license verification to your MT4 or MT5 EA —in under 10 minutes. No servers. No databases. No backend experience required.

Table of Contents

Toggle
  • What You’ll Build
  • Prerequisites
  • Step 1: Create Your LicenseShield Account
  • Step 2: Download the MQL Library
  • Step 3: Add Verification to Your EA
      • MQL4 Version
      • MQL5 Version
  • Step 4: Enable WebRequest
  • Step 5: Compile and Test
  • Step 6: Check Your Dashboard
  • Managing Licenses
    • Approving a Paid Customer
    • Revoking Access
    • Viewing Activity
  • Handling Edge Cases
    • What if the user has no internet?
    • What about Strategy Tester?
    • What if LicenseShield is down?
  • Upgrading Beyond Free Tier
  • Summary
  • Ready to protect your EA?

What You’ll Build

By the end of this tutorial, your EA will:

  1. Check license status on every startup
  2. Auto-register new users as trial accounts
  3. Display trial days remaining to prospects
  4. Block execution when license is invalid or expired

You’ll manage everything from a web dashboard —no recompiling needed.

Prerequisites

  • An MQL4 or MQL5 Expert Advisor (any working EA)
  • A free LicenseShield account at licenses.barmenteros.com
  • 10 minutes

Step 1: Create Your LicenseShield Account

  1. Go to licenses.barmenteros.com/register
  2. Enter your email and create a password
  3. Verify your email (check spam folder if needed)
  4. Log in to your dashboard

You’ll see your API Key on the dashboard. Keep this tab open —you’ll need it in Step 3.

Step 2: Download the MQL Library

From your dashboard:

  1. Click Quick Start in the sidebar
  2. Download `LicenseShield.ex4` (for MT4) or `LicenseShield.ex5` (for MT5)
  3. Save it to your MetaTrader `Libraries` folder:
    • MT4: `C:\Users\[You]\AppData\Roaming\MetaQuotes\Terminal\[ID]\MQL4\Libraries\`
    • MT5: `C:\Users\[You]\AppData\Roaming\MetaQuotes\Terminal\[ID]\MQL5\Libraries\`

Step 3: Add Verification to Your EA

Open your EA’s source file and add these lines:

MQL4 Version

#import "LicenseShield.ex4"
   bool VerifyLicense(string vendorId, string apiKey);
#import
// Add this at the top of OnInit()
int OnInit()
{
   // License verification - blocks execution if invalid
   if(!VerifyLicense("YOUR_API_KEY", ""))
   {
      Alert("License verification failed. Please contact support.");
      return INIT_FAILED;
   }
   
   // Your existing OnInit code below...
   
   return INIT_SUCCEEDED;
}

MQL5 Version

#import "LicenseShield.ex5"
   bool VerifyLicense(string vendorId, string apiKey);
#import
// Add this at the top of OnInit()
int OnInit()
{
   // License verification - blocks execution if invalid
   if(!VerifyLicense("YOUR_API_KEY", ""))
   {
      Alert("License verification failed. Please contact support.");
      return INIT_FAILED;
   }
   
   // Your existing OnInit code below...
   
   return INIT_SUCCEEDED;
}

Replace `YOUR_API_KEY` with the API key from your dashboard.

Step 4: Enable WebRequest

Before testing, you need to allow your EA to make web requests:

  1. In MetaTrader, go to Tools → Options → Expert Advisors
  2. Check “Allow WebRequest for listed URL“
  3. Add: `https://licenses.barmenteros.com`
  4. Click OK

Step 5: Compile and Test

  1. Compile your EA in MetaEditor (F7)
  2. Attach to any chart in your demo terminal
  3. Check the Experts tab for the verification result

You should see something like:

LicenseShield: Verification successful - Trial (7 days remaining)

Step 6: Check Your Dashboard

Go back to your LicenseShield dashboard. Click Licenses in the sidebar.

You’ll see a new entry:

AccountBrokerStatusLast Seen
12345678Name-Demo01Trial (7 days)Just now

This account was auto-registered as a trial. No manual setup needed!

Managing Licenses

Approving a Paid Customer

When a customer pays (or you want to extend a trial):

  1. Find their account in your license list
  2. Look for the Actions column on the right
  3. Click the Reactivate or Enable button
  4. Done —the Status updates to “Active” immediately

Revoking Access

If a customer requests a refund or their subscription expires:

  1. Find their account
  2. Click the Disable button in the Actions column
  3. The Status changes to “Disabled“
  4. Next time their EA starts, it will be blocked

Viewing Activity

The Last Seen column shows when each license was last verified. Use this to:

  • Identify active vs. inactive customers
  • Track trial users who might convert
  • See which accounts are actually using the EA

Handling Edge Cases

What if the user has no internet?

The EA will fail to verify and return `INIT_FAILED`. This is by design—offline piracy is the most common type.

What about Strategy Tester?

Strategy Tester uses account number 0, which LicenseShield automatically allows. Your EA will work in backtests without license issues.

What if LicenseShield is down?

We maintain 99.9%+ uptime. In the rare event of an outage, verified licenses are cached for 24 hours. New verifications will fail, but existing valid licenses continue working.

Upgrading Beyond Free Tier

The Free tier includes:

  • 10 verifications/day
  • 1 license
  • 7-day fixed trial period

If you’re selling more EAs or need higher limits, view pricing →

Summary

You’ve just added professional license verification to your EA:

  1. Created a LicenseShield account
  2. Downloaded the MQL library
  3. Added 3 lines of code
  4. Enabled WebRequest
  5. Tested the integration

Total time: About 10 minutes.

Now you can focus on building great trading software —LicenseShield handles the licensing.

Questions? Reply to any LicenseShield email or contact [email protected].

Ready to protect your EA?

Start free with LicenseShield →

Written by:
barmenteros FX
Published on:
January 9, 2026
Last Updated:
January 12, 2026
Thoughts:
No comments yet

Categories: Blog

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Explore more

Get a Free Quote Get Inspiration Get Connected

Footer

barmenteros FX

Avenida Principe Salman, 6, 5th
29603 Marbella (Malaga) — Spain

Copyright © 2026

Footer

COMPANY

  • Home
  • About Us
  • Contact
  • Request Quote

SERVICES

  • MT4 Programmers
  • MT5 Programmers
  • EA Programming
  • Forex Programming
  • MQL4 Programming
  • MQL5 Programming
  • MetaTrader 4/5 License Management
  • EA Debugging and Code Review
  • All Services

PRODUCTS

  • My account
  • LicenseShield – MT4/MT5 License Protection
  • Latest Offers
  • MT4 Indicators
  • MT5 Indicators

LEGAL

  • Terms and Conditions
  • Privacy Policy
  • Cookies Policy
  • Risk Disclosure
  • Payments & Refunds Policy
  • Warranty & Support Policy
  • Intellectual Property Notice
  • General Disclaimer