AesHmac encrypts texts and bytes in MQL5 so that only a program holding the same key can read them. It is one include file with no other dependencies, built on the terminal's own CryptEncode. Use it for an API token in a settings file, a licence string, or a message two of your programs pass through a file or a web request.
Encryption alone does not tell you whether someone changed the message. AesHmac adds a tag that does: a wrong key, one changed character or text that was never sealed is refused with an error code, never decrypted into garbage that your program then tries to use.
#include <AesHmac\AesHmac.mqh>
#include <AesHmac\AesHmac.mqh> void OnStart() { uchar key[]; if (AesHmacKeyFromPassword("a long password", "MyEA", AES_HMAC_DEFAULT_ITERATIONS, key) != AES_HMAC_OK) { return; } string sealed; AesHmacSeal(key, "{\"api_token\":\"tk_5f2c9a71\"}", sealed); Print(sealed); // base64, different every time string text; int err = AesHmacOpen(key, sealed, text); if (err != AES_HMAC_OK) { Print("refused: ", AesHmacErrorText(err)); return; } Print(text); // {"api_token":"tk_5f2c9a71"} }
The attached AesHmacExample script runs the self test, makes a key from a password, seals a secret twice, saves it to MQL5\Files\AesHmac\secret.txt, reads it back and opens it, then shows the three refusals:
self test aes_block=ok ctr=ok hmac=ok pbkdf2=ok
key made iterations=10000 ms=14
sealed again same_as_first=false
saved and opened file=AesHmac\secret.txt text={"api_token":"tk_5f2c9a71","server":"demo"}
refused case=wrong_password reason="wrong key, or the message was changed"
refused case=one_character_changed reason="wrong key, or the message was changed"
refused case=not_sealed reason="not a sealed message" The picture is a real run on a demo account.

| Call | What it does |
|---|---|
| AesHmacKeyFromPassword(password, salt, iterations, key) | Make a 32-byte key from a password; use one salt per program |
| AesHmacSeal(key, text, sealed), AesHmacOpen(key, sealed, text) | Seal a text into base64 and open it again |
| AesHmacSealBytes(key, plain, sealed), AesHmacOpenBytes(key, sealed, plain) | The same for bytes; a sealed message is 48 bytes longer than the plain one |
| AesHmacErrorText(code) | Describe an error code |
| AesHmacEncryptBlock(key, plain, cipher), AesHmacCtr(key, counter, source, output) | One AES-256 block, and AES-256 in CTR mode (the same call decrypts) |
| AesHmacMac(key, data, mac), AesHmacPbkdf2(password, salt, iterations, size, key), AesHmacSha256(data, hash) | HMAC-SHA256, PBKDF2-HMAC-SHA256 and SHA-256 |
| AesHmacFromHex(hex, bytes), AesHmacToHex(bytes), AesHmacUtf8(text, bytes) | Hex and UTF-8 helpers |
A key compiled into a program keeps out other programs and edited files, not someone who takes the program apart.
History Gaps: find missing bars before you backtest
Checks the chart's history against the symbol's trading sessions and separates real holes from holiday short sessions and days without bars. Marks the holes on the chart, shows coverage and the largest hole, warns when the history stops short of now, and can write a CSV report.
Prop Firm Equity Guard daily loss and max drawdown protector
Prop Firm Equity Guard protects prop-firm challenges and funded accounts. It monitors live equity against your daily loss and max drawdown limits, then closes all positions, deletes pending orders and locks trading before the firm's limit is hit. A safety buffer makes it act early, and anything opened while locked is closed instantly. It supports static and trailing drawdown, an optional profit target lock and alerts, saves its state through restarts, and shows an on-chart dashboard with room left and a reset countdown. It works alongside manual trading and other EAs.
Structural Swing Migration BUY
Structural Swing Migration BUY is an educational Expert Advisor for MetaTrader 5 that opens BUY positions when confirmed swing highs and swing lows move upward together. It evaluates closed M15 candles and combines structural confirmation with a volatility threshold and a bullish candle filter.
Demetra Symbol Spec Sheet
Puts the contract specification of the chart symbol on one sheet, including the money value of one point and the margin for one lot.