Guarda come scaricare robot di trading gratuitamente
Ci trovi su Twitter!
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

AccountGuard - lock your EA to licensed accounts (single include) - libreria per MetaTrader 5

Manit Chin
Manit Chin
MQL5 Developer | Expert Advisors, Indicators, Backtesting
Visualizzazioni:
63
Valutazioni:
(1)
Pubblicato:
Freelance MQL5 Hai bisogno di un robot o indicatore basato su questo codice? Ordinalo su Freelance Vai a Freelance

AccountGuard is a small single-header account lock for MT5 Expert Advisors. Restrict your EA to specific account numbers, with an optional demo allowance, an expiry date and a Strategy Tester bypass so you can still backtest.

The licence is compiled into the .ex5 with #define lines, so the end user cannot unlock it from the Inputs tab.

AccountGuard chart comment examples

How to use

#define AG_ALLOWED_LOGINS "12345678, Broker-Real8:5012345678"
#define AG_ALLOW_DEMO     true                  // any demo account can try it
#define AG_EXPIRY         D'2026.12.31 23:59'   // 0 = never
#include "AccountGuard.mqh"

int  OnInit() { AG_Init(); ... }
void OnTick()
  {
   ManageOpenPositions();        // exits keep working
   if(!AG_Allowed()) return;     // no NEW trades when locked
   ...
  }

Settings (#define, before the #include)

  • AG_ALLOWED_LOGINS: licensed accounts. Each entry is a login (any server) or "server:login" (that server only). Commas, semicolons, spaces or new lines all work as separators.
  • AG_ALLOW_DEMO: true = any demo account may use the EA (for trials).
  • AG_EXPIRY: licence end date and time, or 0 = never. Example: a 30-day rental or a 7-day trial.
  • AG_ALLOW_TESTER: true (default) = always allowed in the Strategy Tester, so buyers can backtest.

Functions

  • AG_Init(): call once in OnInit.
  • AG_Allowed(): call before every NEW order. Returns false when locked. Exits and trailing stops placed before the gate keep working.
  • AG_Reason(): the reason text for your panel, e.g. "account 87654321 (Broker-Real2) is not licensed".

Inputs

  • InpAGMessage: text shown in the alert when the EA is locked.
  • InpAGSelfTest: run the built-in self-test (32 checks, including cases that must stay locked).

Safety

  • Safe by default: an empty list, a typo in the list, an expired licence, or account details that are not loaded yet (VPS start / reconnect) all mean LOCKED. It re-checks automatically.
  • Expiry uses the later of the server tick time and the trade-server time, so setting the PC clock back does not extend it.
  • The lock reason is printed once, not on every tick.
  • No DLL, no WebRequest, no files: works in the Strategy Tester and on any VPS.
  • The library never sends orders.

Example EA

AccountGuard_Demo.mq5 shows "AccountGuard: allowed" or "AccountGuard: LOCKED" with the reason on the chart. On a live or demo chart it never trades. In the Strategy Tester only (InpTesterDemo), it opens one minimum-lot example trade per day through the AG_Allowed() gate.

Honest limits

  • This raises the bar against casual copying of a compiled .ex5. It is not unbreakable DRM.
  • To change the licence (new account, new expiry) you recompile and send a new .ex5.
PropGuard Lite - daily and max loss guard for prop firm accounts PropGuard Lite - daily and max loss guard for prop firm accounts

Risk tool for prop firm accounts: closes all positions and blocks new trades when the daily loss or max loss limit is reached. Never opens trades on a live chart.

Line Master – Fast and Slow Trend Lines with Trend Change Signals Line Master – Fast and Slow Trend Lines with Trend Change Signals

Line Master is a trend-following indicator for MetaTrader 5 that displays fast and slow dynamic price lines to help traders identify market direction and potential trend changes. Blue represents a bullish trend, while red represents a bearish trend. Visual markers highlight changes in the indicator's trend state. The indicator includes adjustable Fast Length and Slow Length parameters, allowing traders to customize its sensitivity. It can be used on forex, gold (XAUUSD), indices, and other MT5-supported markets. For better results, combine its signals with price action, support and resistance levels, and proper risk management. Signals are not guaranteed and should be confirmed before entering a trade.

Accelerator Oscillator (AC) Accelerator Oscillator (AC)

The Acceleration/Deceleration Indicator (AC) measures acceleration and deceleration of the current driving force.

MACD Signals MACD Signals

Indicator edition for new platform.