Watch how to download trading robots for free
Find us on Facebook!
Join our fan page
Join our fan page
You liked the script? Try it in the MetaTrader 5 terminal
- Views:
- 80
- Rating:
- Published:
-
Need a robot or indicator based on this code? Order it on Freelance Go to Freelance
CErrorHandler is a robust, self-contained trade error classifier and automated recovery framework designed for MQL4 Expert Advisors.
### Features
- Maps MQL4 trade server return codes onto five distinct recovery actions (IGNORE, RETRY, WAIT, STOP_EA, ALARM).
- Tracks repeat-failure series per individual error code with configurable escalation limits.
- Implements integer-based exponential back-off delays to prevent EA thread blocking and eliminate busy-loops.
- Provides built-in diagnostic hints for error codes that are frequently misread or mishandled (e.g., ERR_INVALID_STOPS, ERR_TRADE_TOO_MANY_ORDERS).
### Minimal Usage
#include "ErrorHandler.mqh"
CErrorHandler g_err("MyEA");
for(int attempt = 0; attempt < 10; attempt++)
{
ResetLastError();
int ticket = OrderSend(...);
if(ticket >= 0) { g_err.ResetRetry(); break; }
switch(g_err.Handle(GetLastError(), "OrderSend BUY"))
{
case EH_ACTION_RETRY:
case EH_ACTION_WAIT: continue;
case EH_ACTION_ALARM: continue;
case EH_ACTION_STOP_EA: ExpertRemove(); return;
case EH_ACTION_IGNORE: break;
}
}
H1 Container MTF Boxes
Visual MT4 indicator that draws the current or selected H1 range and nested M30, M15, M5 and M1 boxes. An EA based on this logic is in development.
Quantora Trade Manager MT4 - Professional Position Management Utility
Professional open-source trade management utility for MetaTrader 4. Automatically applies Stop Loss, Take Profit, Break Even and Trailing Stop while providing a modern dashboard for efficient position management.
Three Colors
Example: Moving Average indicator filling by different colors
MACD Sample
Classical MACD Sample.
