MetaTrader

MetaTrader Libraries for MT5

UPDATE
Showing 391 results

ASQ Order Executor

FEATURES:

- Automatic retry logic with configurable max attempts and delay - Requote handling with separate retry path from rejections - Slippage calculation in pips with violation detection - Auto-normalization of SL/TP against broker stop level - Auto-detection of fill policy (FOK / IOC / RETURN) - Full execution statistics (success rate, avg slippage, avg exec time, volume) - Market orders (Buy / Sell) and pending orders (Limit / Stop, Buy / Sell) - Position management (close, partial close, modify SL/TP, close-all-by-magic) - Human-readable result codes with 10 execution states

- Verbose logging toggle for debugging

DEMO EA INCLUDED: Attach to any chart: — Dashboard with BUY, SELL, CLOSE ALL action buttons — Live execution statistics with color-coded metrics — Success rate gauge (green >=95%, amber >=80%, red below) — Total attempts, successful, rejections, requotes, timeouts, slippage violations — Avg and max slippage in pips, avg execution time in ms, total volume executed — RESET button to clear stats mid-session USAGE: #include "ASQ_OrderExecutor.mqh" CASQOrderExecutor exec; exec.Initialize(_Symbol, 20260417); exec.SetMaxRetries(3); exec.SetMaxSlippage(30); exec.SetVerboseLogging(true); ENUM_ASQ_EXEC_RESULT result = exec.Buy(0.10, sl, tp, "Strategy A"); if(result == ASQ_EXEC_SUCCESS)    Print("Executed at ", exec.GetStats().avgSlippagePips, " pips slip"); exec.CloseAllByMagic(); Place both files in the same folder — compiles instantly, no subfolder setup needed. FILES: - ASQ_OrderExecutor.mqh — Library (960 lines) - ASQ_OrderExecutor_Demo.mq5 — Demo EA (334 lines) MetaTrader 5, all brokers, all instruments, all timeframes. Free and open-source. 1,294 lines of production MQL5.

Calculate Lot Percent

The CalculateLot function is designed to automatically calculate the trading lot size based on risk management principles. It allows a trader to specify the percentage of the account balance he is willing to risk in a trade and, based on this, determine the optimal position volume.

Syntax

Parameters Return value

The function returns the normalised lot volume ( double ), which:

  • Conforms to the rounding rules to the volume step ( VOLUME_STEP );

  • Does not exceed the maximum allowed volume ( VOLUME_MAX );

  • Is not less than the minimum allowed volume ( VOLUME_MIN ).

If the calculated value exceeds the allowed limits, the function returns a limited value (minLot or maxLot).

Operating algorithm
  1. Obtaining account and symbol parameters

    • Current balance ( ACCOUNT_BALANCE )

    • Tick value ( SYMBOL_TRADE_TICK_VALUE )

    • Minimum, maximum and step of lot change

  2. Calculation of risk amount in deposit currency

  3. Calculation of lot volume

  4. Normalisation and validation

    • Rounding to the nearest step ( VOLUME_STEP )

    • Minimum and maximum value validation

Examples of use Example 1. Basic use in an Expert Advisor

Example 2. Use in a script with error checking

ASQ Session Manager

ASQ Session Manager v1.2 — Free, Open-Source

Trading outside your session is the #1 reason retail EAs bleed equity. ASQ Session Manager gives your EA institutional-grade session awareness — it knows exactly which session is active, whether you're in a kill zone, how volatile the current session is compared to its 20-day average, and if the Asian range just broke out. Drop it into any EA and stop trading blind.

FEATURES: - 4-session detection — Sydney, Tokyo, London, New York with automatic broker GMT offset - Kill zone identification — London Open, NY Open, Asian, London Close, London-NY Overlap - Asian range breakout — automatic range calculation (00:00-06:00 GMT), breakout detection, false-break filtering, and 1.5x expansion targets - Session volatility scoring — 5-tier ATR-relative meter (Dead/Low/Normal/High/Explosive) scored against 20-day average range - Countdown timer — always shows the next upcoming session open or kill zone with hours and minutes remaining - Session phase tracking — Early, Active, Midday, Late phases for each session - 3 built-in signal types — Asian Range Breakout, London Open Momentum, Overlap Continuation with entry/SL/TP levels - 20-day session range statistics with best-session analysis - NFP Friday detection — auto-detects first Friday of month, blocks trading to avoid Non-Farm Payroll chaos - Safety filters — weekend, Friday late close, Monday early open protection - Session overlap analysis with priority resolution (London > NY > Tokyo > Sydney) DEMO INDICATOR INCLUDED: Drop ASQ_SessionManager_Demo on any chart to see: — Colored session boxes with labels (LDN=Blue, NYC=Red, TKY=Purple, SYD=Teal) — Kill zone highlights in gold with direction and strength tooltips — Asian range box with midline, breakout arrows, false-break markers, and 1.5x expansion target lines

— Professional multi-panel dashboard: session + phase + progress bar, kill zone + overlap + close countdown, volatility meter, countdown to next event, Asian range state, signal panel with Entry/SL/TP, 20-day average ranges, and trading status with NFP Friday warning

USAGE: #include "ASQ_SessionManager.mqh" CASQSessionManager session; session.Initialize(_Symbol, pipValue, 0);  // 0 = auto-detect GMT offset session.Update(bid, ask);                   // Call on every tick Place both files in the same folder — compiles instantly, no subfolder setup needed. FILES: - ASQ_SessionManager.mqh — Library (1,341 lines) - ASQ_SessionManager_Demo.mq5 — Demo indicator (628 lines) MetaTrader 5, all brokers, all forex instruments, all timeframes. Free and open-source. 1,969 lines of production MQL5. AlgoSphere Quant — Precision before profit.

Session Time Filter Library

//+------------------------------------------------------------------+ //|                                           SessionTimeFilter.mqh  | //+------------------------------------------------------------------+ #property description "Session Time Filter Library" #property description "Filter trades by trading sessions (London, NY, Tokyo, Sydney)" #property library //+------------------------------------------------------------------+ //| Session Definitions (Server Time)                                 | //+------------------------------------------------------------------+ enum ENUM_SESSION    SESSION_SYDNEY,      // Sydney Session    SESSION_TOKYO,       // Tokyo Session    SESSION_LONDON,      // London Session    SESSION_NEWYORK,     // New York Session    SESSION_LONDON_NY,   // London-NY Overlap    SESSION_CUSTOM       // Custom Session //+------------------------------------------------------------------+ //| Session Time Structure                                            | //+------------------------------------------------------------------+ struct SSessionTime    int startHour;    int startMinute;    int endHour;    int endMinute;    string name; //+------------------------------------------------------------------+ //| CSessionFilter Class                                              | //+------------------------------------------------------------------+ class CSessionFilter private:    SSessionTime  m_sessions[6];    int           m_gmtOffset;    bool          m_initialized;        //--- Initialize default session times (GMT)    void InitSessions()       // Sydney: 21:00 - 06:00 GMT       m_sessions[SESSION_SYDNEY].startHour = 21;       m_sessions[SESSION_SYDNEY].startMinute = 0;       m_sessions[SESSION_SYDNEY].endHour = 6;       m_sessions[SESSION_SYDNEY].endMinute = 0;       m_sessions[SESSION_SYDNEY].name = "Sydney";              // Tokyo: 00:00 - 09:00 GMT       m_sessions[SESSION_TOKYO].startHour = 0;       m_sessions[SESSION_TOKYO].startMinute = 0;       m_sessions[SESSION_TOKYO].endHour = 9;       m_sessions[SESSION_TOKYO].endMinute = 0;       m_sessions[SESSION_TOKYO].name = "Tokyo";              // London: 07:00 - 16:00 GMT       m_sessions[SESSION_LONDON].startHour = 7;       m_sessions[SESSION_LONDON].startMinute = 0;       m_sessions[SESSION_LONDON].endHour = 16;       m_sessions[SESSION_LONDON].endMinute = 0;       m_sessions[SESSION_LONDON].name = "London";              // New York: 12:00 - 21:00 GMT       m_sessions[SESSION_NEWYORK].startHour = 12;       m_sessions[SESSION_NEWYORK].startMinute = 0;       m_sessions[SESSION_NEWYORK].endHour = 21;       m_sessions[SESSION_NEWYORK].endMinute = 0;       m_sessions[SESSION_NEWYORK].name = "New York";              // London-NY Overlap: 12:00 - 16:00 GMT       m_sessions[SESSION_LONDON_NY].startHour = 12;       m_sessions[SESSION_LONDON_NY].startMinute = 0;       m_sessions[SESSION_LONDON_NY].endHour = 16;       m_sessions[SESSION_LONDON_NY].endMinute = 0;       m_sessions[SESSION_LONDON_NY].name = "London-NY Overlap";              // Custom: Default same as London       m_sessions[SESSION_CUSTOM].startHour = 7;       m_sessions[SESSION_CUSTOM].startMinute = 0;       m_sessions[SESSION_CUSTOM].endHour = 16;       m_sessions[SESSION_CUSTOM].endMinute = 0;       m_sessions[SESSION_CUSTOM].name = "Custom";        //--- Convert time to minutes since midnight    int TimeToMinutes(int hour, int minute)       return hour * 60 + minute;        //--- Adjust for GMT offset    int AdjustForGMT(int minutes)       minutes += m_gmtOffset * 60;       if(minutes < 0) minutes += 1440;       if(minutes >= 1440) minutes -= 1440;       return minutes; public:    //--- Constructor    CSessionFilter()       m_gmtOffset = 0;       m_initialized = false;       InitSessions();        //--- Initialize with GMT offset    bool Init(int gmtOffset = 0)       m_gmtOffset = gmtOffset;       m_initialized = true;       return true;        //--- Set custom session times    void SetCustomSession(int startHour, int startMin, int endHour, int endMin)       m_sessions[SESSION_CUSTOM].startHour = startHour;       m_sessions[SESSION_CUSTOM].startMinute = startMin;       m_sessions[SESSION_CUSTOM].endHour = endHour;       m_sessions[SESSION_CUSTOM].endMinute = endMin;        //--- Check if current time is within session    bool IsInSession(ENUM_SESSION session)       if(!m_initialized) Init();              MqlDateTime dt;       TimeToStruct(TimeCurrent(), dt);              int currentMinutes = TimeToMinutes(dt.hour, dt.min);       int startMinutes = AdjustForGMT(TimeToMinutes(m_sessions[session].startHour,                                                       m_sessions[session].startMinute));       int endMinutes = AdjustForGMT(TimeToMinutes(m_sessions[session].endHour,                                                     m_sessions[session].endMinute));              // Handle sessions that cross midnight       if(startMinutes > endMinutes)          return (currentMinutes >= startMinutes || currentMinutes < endMinutes);              return (currentMinutes >= startMinutes && currentMinutes < endMinutes);        //--- Check if specific time is within session    bool IsTimeInSession(datetime time, ENUM_SESSION session)       if(!m_initialized) Init();              MqlDateTime dt;       TimeToStruct(time, dt);              int currentMinutes = TimeToMinutes(dt.hour, dt.min);       int startMinutes = AdjustForGMT(TimeToMinutes(m_sessions[session].startHour,                                                       m_sessions[session].startMinute));       int endMinutes = AdjustForGMT(TimeToMinutes(m_sessions[session].endHour,                                                     m_sessions[session].endMinute));              if(startMinutes > endMinutes)          return (currentMinutes >= startMinutes || currentMinutes < endMinutes);              return (currentMinutes >= startMinutes && currentMinutes < endMinutes);        //--- Get current active session(s)    string GetActiveSession()       string result = "";              if(IsInSession(SESSION_SYDNEY))          result += (result == "" ? "" : ", ") + m_sessions[SESSION_SYDNEY].name;       if(IsInSession(SESSION_TOKYO))          result += (result == "" ? "" : ", ") + m_sessions[SESSION_TOKYO].name;       if(IsInSession(SESSION_LONDON))          result += (result == "" ? "" : ", ") + m_sessions[SESSION_LONDON].name;       if(IsInSession(SESSION_NEWYORK))          result += (result == "" ? "" : ", ") + m_sessions[SESSION_NEWYORK].name;              return (result == "" ? "No Major Session" : result);        //--- Get session name    string GetSessionName(ENUM_SESSION session)       return m_sessions[session].name;        //--- Get time until session starts (in minutes)    int MinutesUntilSession(ENUM_SESSION session)       if(IsInSession(session)) return 0;              MqlDateTime dt;       TimeToStruct(TimeCurrent(), dt);              int currentMinutes = TimeToMinutes(dt.hour, dt.min);       int startMinutes = AdjustForGMT(TimeToMinutes(m_sessions[session].startHour,                                                       m_sessions[session].startMinute));              int diff = startMinutes - currentMinutes;       if(diff < 0) diff += 1440;              return diff;        //--- Get time remaining in session (in minutes)    int MinutesRemainingInSession(ENUM_SESSION session)       if(!IsInSession(session)) return 0;              MqlDateTime dt;       TimeToStruct(TimeCurrent(), dt);              int currentMinutes = TimeToMinutes(dt.hour, dt.min);       int endMinutes = AdjustForGMT(TimeToMinutes(m_sessions[session].endHour,                                                     m_sessions[session].endMinute));              int diff = endMinutes - currentMinutes;       if(diff < 0) diff += 1440;              return diff;        //--- Check if it's a weekday (Mon-Fri)    bool IsWeekday()       MqlDateTime dt;       TimeToStruct(TimeCurrent(), dt);       return (dt.day_of_week >= 1 && dt.day_of_week <= 5);        //--- Check specific day of week    bool IsDayOfWeek(int day)  // 0=Sunday, 1=Monday, etc.       MqlDateTime dt;       TimeToStruct(TimeCurrent(), dt);       return (dt.day_of_week == day);        //--- Filter by multiple sessions    bool IsInAnySessions(bool sydney, bool tokyo, bool london, bool newyork)       if(sydney && IsInSession(SESSION_SYDNEY)) return true;       if(tokyo && IsInSession(SESSION_TOKYO)) return true;       if(london && IsInSession(SESSION_LONDON)) return true;       if(newyork && IsInSession(SESSION_NEWYORK)) return true;       return false; //+------------------------------------------------------------------+ //| Exported Functions for procedural usage                           | //+------------------------------------------------------------------+ CSessionFilter g_sessionFilter; //+------------------------------------------------------------------+ //| Initialize session filter                                         | //+------------------------------------------------------------------+ bool SessionFilterInit(int gmtOffset = 0) export    return g_sessionFilter.Init(gmtOffset); //+------------------------------------------------------------------+ //| Check if in session                                               | //+------------------------------------------------------------------+ bool IsInTradingSession(ENUM_SESSION session) export    return g_sessionFilter.IsInSession(session); //+------------------------------------------------------------------+ //| Get active sessions string                                        | //+------------------------------------------------------------------+ string GetActiveTradingSessions() export    return g_sessionFilter.GetActiveSession(); //+------------------------------------------------------------------+ //| Check if London-NY overlap                                        | //+------------------------------------------------------------------+ bool IsLondonNYOverlap() export    return g_sessionFilter.IsInSession(SESSION_LONDON_NY); //+------------------------------------------------------------------+ //| Check if Asian session (Sydney + Tokyo)                           | //+------------------------------------------------------------------+ bool IsAsianSession() export    return g_sessionFilter.IsInSession(SESSION_SYDNEY) ||            g_sessionFilter.IsInSession(SESSION_TOKYO); //+------------------------------------------------------------------+ //| Check if European session                                         | //+------------------------------------------------------------------+ bool IsEuropeanSession() export    return g_sessionFilter.IsInSession(SESSION_LONDON); //+------------------------------------------------------------------+ //| Check if American session                                         | //+------------------------------------------------------------------+ bool IsAmericanSession() export    return g_sessionFilter.IsInSession(SESSION_NEWYORK); //+------------------------------------------------------------------+

ASQ News Filter

ASQ News Filter v1.2 — Free, Open-Source

One surprise NFP print can wipe a week of profits. ASQ News Filter gives your EA a complete economic calendar shield — it auto-fetches live events from the MQL5 Calendar API, identifies which ones affect your pair, and blocks trading before and after high-impact releases. NFP and FOMC get extended cooldown windows because the volatility doesn't stop when the candle closes.

FEATURES: - MQL5 Calendar API live integration — auto-fetches events every 5 minutes with actual/forecast/previous values - High/Medium/Low impact filtering with configurable mode (High Only, High+Medium, All) - Configurable pre-news and post-news trading pauses (5-120 minutes) - Special event cooldowns — NFP gets 60-minute post-news pause, FOMC gets 90 minutes, fully configurable - 9 central banks covered — built-in date schedules for Fed (FOMC), ECB, BOE, BOJ, RBA, BOC, SNB, RBNZ, plus NFP - Automatic event classification — detects NFP, FOMC, CPI, GDP, PMI, Retail, Employment from event title - Currency-specific filtering — auto-detects base/quote from symbol, handles broker suffixes (EURUSDm, EURUSD.r) - News intensity scoring — 4-level gauge: Calm, Caution (event within 2h), Danger (within pre-window), Blackout (blocked) - Next 3 upcoming events list with impact level and countdown - Event deduplication and automatic cleanup of passed events - Custom event support — add your own events programmatically DEMO EA INCLUDED: Attach to any forex chart to see the full dashboard: — Trading status (Allowed/Blocked) with intensity meter — Next event name, currency, impact, type, and countdown timer — Pre-news and post-news window indicators with active cooldown display — Upcoming events list (next 3) with H/M/L impact color dots — Event counts by impact level and total events loaded

— Filter mode display

USAGE: #include "ASQ_NewsFilter.mqh" CASQNewsFilter news; news.Initialize(_Symbol); news.SetMode(ASQ_NEWS_HIGH_ONLY); news.Update();                        // Call on every tick Place both files in the same folder — compiles instantly, no subfolder setup needed. FILES: - ASQ_NewsFilter.mqh — Library (1,034 lines) - ASQ_NewsFilter_Demo.mq5 — Demo EA (395 lines) MetaTrader 5, all brokers, all forex instruments, all timeframes. Free and open-source. 1,429 lines of production MQL5. AlgoSphere Quant — Precision before profit.

ATR Based Stop Loss Manager

//+------------------------------------------------------------------+ //|                                              StopLossManager.mqh | //+------------------------------------------------------------------+ #property strict //+------------------------------------------------------------------+ //| Enumeration of stop loss calculation methods                     | //+------------------------------------------------------------------+ enum ENUM_SL_METHOD    SL_METHOD_FIXED_PIPS=0,    // Fixed Pips    SL_METHOD_ATR=1,           // ATR Based    SL_METHOD_SWING=2,         // Swing High/Low    SL_METHOD_PERCENT=3        // Percentage of Price //+------------------------------------------------------------------+ //| Enumeration of trailing stop methods                             | //+------------------------------------------------------------------+ enum ENUM_TRAIL_METHOD    TRAIL_NONE=0,              // No Trailing    TRAIL_FIXED=1,             // Fixed Distance    TRAIL_ATR=2,               // ATR Based    TRAIL_STEP=3,              // Step Trailing    TRAIL_BREAKEVEN=4          // Breakeven Only //+------------------------------------------------------------------+ //| Structure for stop loss calculation result                       | //+------------------------------------------------------------------+ struct SStopLossResult    double            price;            // Stop loss price level    double            distance_points;  // Distance in points    double            distance_pips;    // Distance in pips    bool              valid;            // Calculation valid flag    string            error;            // Error message if invalid //+------------------------------------------------------------------+ //| Class for managing stop loss calculations and trailing           | //+------------------------------------------------------------------+ class CStopLossManager private:    string            m_symbol;         // Trading symbol    ENUM_TIMEFRAMES   m_timeframe;      // Calculation timeframe    int               m_atr_handle;     // ATR indicator handle    int               m_atr_period;     // ATR period    double            m_point;          // Symbol point size    double            m_pip_size;       // Pip size in points    int               m_digits;         // Symbol digits    int               m_stops_level;    // Broker minimum stops level    bool              m_initialized;    // Initialization flag    //--- Private methods    double            GetATRValue(const int shift=0);    double            GetSwingHigh(const int lookback);    double            GetSwingLow(const int lookback);    double            NormalizePrice(const double price);    double            AdjustForStopsLevel(const double sl_price,                                          const double entry_price,                                          const bool is_buy); public:    //--- Constructor and destructor                      CStopLossManager(void);                     ~CStopLossManager(void);    //--- Initialization    bool              Init(const string symbol,                           const ENUM_TIMEFRAMES timeframe=PERIOD_CURRENT,                           const int atr_period=14);    //--- Stop loss calculation methods    SStopLossResult   CalculateStopLoss(const ENUM_SL_METHOD method,                                        const bool is_buy,                                        const double entry_price,                                        const double param1=0.0,                                        const double param2=0.0);    SStopLossResult   CalculateFixedPipsSL(const bool is_buy,                                           const double entry_price,                                           const double pips);    SStopLossResult   CalculateATRSL(const bool is_buy,                                     const double entry_price,                                     const double atr_multiplier=1.5);    SStopLossResult   CalculateSwingSL(const bool is_buy,                                       const double entry_price,                                       const int lookback=10,                                       const double buffer_pips=5.0);    SStopLossResult   CalculatePercentSL(const bool is_buy,                                         const double entry_price,                                         const double percent=1.0);    //--- Take profit calculation    double            CalculateTakeProfit(const bool is_buy,                                          const double entry_price,                                          const double sl_price,                                          const double rr_ratio=2.0);    //--- Trailing stop methods    double            CalculateTrailingStop(const ENUM_TRAIL_METHOD method,                                            const bool is_buy,                                            const double entry_price,                                            const double current_sl,                                            const double current_price,                                            const double param1=0.0,                                            const double param2=0.0);    double            TrailFixed(const bool is_buy,                                 const double current_sl,                                 const double current_price,                                 const double trail_distance_pips);    double            TrailATR(const bool is_buy,                               const double current_sl,                               const double current_price,                               const double atr_multiplier=2.0);    double            TrailStep(const bool is_buy,                                const double entry_price,                                const double current_sl,                                const double current_price,                                const double step_pips=10.0);    double            TrailBreakeven(const bool is_buy,                                     const double entry_price,                                     const double current_sl,                                     const double current_price,                                     const double trigger_pips=20.0,                                     const double be_offset_pips=2.0);    //--- Utility methods    double            PipsToPoints(const double pips);    double            PointsToPips(const double points);    double            PipsToPrice(const double pips);    //--- Information methods //+------------------------------------------------------------------+ //| Constructor                                                      | //+------------------------------------------------------------------+ CStopLossManager::CStopLossManager(void) : m_symbol(""),                                            m_timeframe(PERIOD_CURRENT),                                            m_atr_handle(INVALID_HANDLE),                                            m_atr_period(14),                                            m_point(0),                                            m_pip_size(0),                                            m_digits(0),                                            m_stops_level(0),                                            m_initialized(false) //+------------------------------------------------------------------+ //| Destructor                                                       | //+------------------------------------------------------------------+ CStopLossManager::~CStopLossManager(void) //--- Release indicator handle    if(m_atr_handle!=INVALID_HANDLE)       IndicatorRelease(m_atr_handle); //+------------------------------------------------------------------+ //| Initialize the stop loss manager                                 | //+------------------------------------------------------------------+ bool CStopLossManager::Init(const string symbol,                             const ENUM_TIMEFRAMES timeframe=PERIOD_CURRENT,                             const int atr_period=14)    m_symbol=symbol;    m_timeframe=(timeframe==PERIOD_CURRENT) ? Period() : timeframe;    m_atr_period=atr_period; //--- Get symbol specifications    m_point=SymbolInfoDouble(symbol,SYMBOL_POINT);    m_digits=(int)SymbolInfoInteger(symbol,SYMBOL_DIGITS);    m_stops_level=(int)SymbolInfoInteger(symbol,SYMBOL_TRADE_STOPS_LEVEL); //--- Calculate pip size (10 points for 5-digit, 1 point for 4-digit)    m_pip_size=(m_digits==5 || m_digits==3) ? m_point*10 : m_point; //--- Validate symbol data    if(m_point==0)       Print("Error: Invalid symbol point value for ",symbol);       return(false); //--- Create ATR indicator handle    m_atr_handle=iATR(symbol,m_timeframe,m_atr_period);    if(m_atr_handle==INVALID_HANDLE)       Print("Error: Failed to create ATR indicator handle");       return(false);    m_initialized=true;    return(true); //+------------------------------------------------------------------+ //| Get ATR indicator value                                          | //+------------------------------------------------------------------+ double CStopLossManager::GetATRValue(const int shift=0)    if(m_atr_handle==INVALID_HANDLE)       return(0.0);    double atr_buffer[1];    if(CopyBuffer(m_atr_handle,0,shift,1,atr_buffer)!=1)       return(0.0);    return(atr_buffer[0]); //+------------------------------------------------------------------+ //| Get swing high price                                             | //+------------------------------------------------------------------+ double CStopLossManager::GetSwingHigh(const int lookback)    double high_buffer[];    ArraySetAsSeries(high_buffer,true);    if(CopyHigh(m_symbol,m_timeframe,0,lookback,high_buffer)!=lookback)       return(0.0);    double highest=high_buffer[0];    for(int i=1; i<lookback; i++)       if(high_buffer[i]>highest)          highest=high_buffer[i];    return(highest); //+------------------------------------------------------------------+ //| Get swing low price                                              | //+------------------------------------------------------------------+ double CStopLossManager::GetSwingLow(const int lookback)    double low_buffer[];    ArraySetAsSeries(low_buffer,true);    if(CopyLow(m_symbol,m_timeframe,0,lookback,low_buffer)!=lookback)       return(0.0);    double lowest=low_buffer[0];    for(int i=1; i<lookback; i++)       if(low_buffer[i]<lowest)          lowest=low_buffer[i];    return(lowest); //+------------------------------------------------------------------+ //| Normalize price to symbol digits                                 | //+------------------------------------------------------------------+ double CStopLossManager::NormalizePrice(const double price)    return(NormalizeDouble(price,m_digits)); //+------------------------------------------------------------------+ //| Adjust stop loss for broker minimum stops level                  | //+------------------------------------------------------------------+ double CStopLossManager::AdjustForStopsLevel(const double sl_price,                                              const double entry_price,                                              const bool is_buy)    if(m_stops_level==0)       return(sl_price);    double min_distance=m_stops_level*m_point;    double current_distance=MathAbs(entry_price-sl_price);    if(current_distance>=min_distance)       return(sl_price); //--- Adjust stop loss to meet minimum distance    if(is_buy)       return(NormalizePrice(entry_price-min_distance));    else       return(NormalizePrice(entry_price+min_distance)); //+------------------------------------------------------------------+ //| Universal stop loss calculation method                           | //+------------------------------------------------------------------+ SStopLossResult CStopLossManager::CalculateStopLoss(const ENUM_SL_METHOD method,                                                     const bool is_buy,                                                     const double entry_price,                                                     const double param1=0.0,                                                     const double param2=0.0)    SStopLossResult result;    ZeroMemory(result);    if(!m_initialized)       result.valid=false;       result.error="Stop loss manager not initialized";       return(result);    switch(method)       case SL_METHOD_FIXED_PIPS:          result=CalculateFixedPipsSL(is_buy,entry_price,param1);          break;       case SL_METHOD_ATR:          result=CalculateATRSL(is_buy,entry_price,param1>0 ? param1 : 1.5);          break;       case SL_METHOD_SWING:          result=CalculateSwingSL(is_buy,entry_price,(int)(param1>0 ? param1 : 10),param2>0 ? param2 : 5.0);          break;       case SL_METHOD_PERCENT:          result=CalculatePercentSL(is_buy,entry_price,param1>0 ? param1 : 1.0);          break;    return(result); //+------------------------------------------------------------------+ //| Calculate fixed pips stop loss                                   | //+------------------------------------------------------------------+ SStopLossResult CStopLossManager::CalculateFixedPipsSL(const bool is_buy,                                                        const double entry_price,                                                        const double pips)    SStopLossResult result;    ZeroMemory(result);    if(pips<=0)       result.valid=false;       result.error="Invalid pips value";       return(result);    double distance=pips*m_pip_size;    if(is_buy)       result.price=NormalizePrice(entry_price-distance);    else       result.price=NormalizePrice(entry_price+distance); //--- Adjust for stops level    result.price=AdjustForStopsLevel(result.price,entry_price,is_buy); //--- Calculate final distances    result.distance_points=MathAbs(entry_price-result.price)/m_point;    result.distance_pips=result.distance_points/(m_pip_size/m_point);    result.valid=true;    return(result); //+------------------------------------------------------------------+ //| Calculate ATR-based stop loss                                    | //+------------------------------------------------------------------+ SStopLossResult CStopLossManager::CalculateATRSL(const bool is_buy,                                                  const double entry_price,                                                  const double atr_multiplier=1.5)    SStopLossResult result;    ZeroMemory(result);    double atr=GetATRValue(0);    if(atr==0)       result.valid=false;       result.error="Failed to get ATR value";       return(result);    double distance=atr*atr_multiplier;    if(is_buy)       result.price=NormalizePrice(entry_price-distance);    else       result.price=NormalizePrice(entry_price+distance); //--- Adjust for stops level    result.price=AdjustForStopsLevel(result.price,entry_price,is_buy); //--- Calculate final distances    result.distance_points=MathAbs(entry_price-result.price)/m_point;    result.distance_pips=result.distance_points/(m_pip_size/m_point);    result.valid=true;    return(result); //+------------------------------------------------------------------+ //| Calculate swing-based stop loss                                  | //+------------------------------------------------------------------+ SStopLossResult CStopLossManager::CalculateSwingSL(const bool is_buy,                                                    const double entry_price,                                                    const int lookback=10,                                                    const double buffer_pips=5.0)    SStopLossResult result;    ZeroMemory(result);    double buffer=buffer_pips*m_pip_size;    if(is_buy)       double swing_low=GetSwingLow(lookback);       if(swing_low==0)          result.valid=false;          result.error="Failed to find swing low";          return(result);       result.price=NormalizePrice(swing_low-buffer);    else       double swing_high=GetSwingHigh(lookback);       if(swing_high==0)          result.valid=false;          result.error="Failed to find swing high";          return(result);       result.price=NormalizePrice(swing_high+buffer); //--- Adjust for stops level    result.price=AdjustForStopsLevel(result.price,entry_price,is_buy); //--- Calculate final distances    result.distance_points=MathAbs(entry_price-result.price)/m_point;    result.distance_pips=result.distance_points/(m_pip_size/m_point);    result.valid=true;    return(result); //+------------------------------------------------------------------+ //| Calculate percentage-based stop loss                             | //+------------------------------------------------------------------+ SStopLossResult CStopLossManager::CalculatePercentSL(const bool is_buy,                                                      const double entry_price,                                                      const double percent=1.0)    SStopLossResult result;    ZeroMemory(result);    if(percent<=0 || percent>100)       result.valid=false;       result.error="Invalid percentage value";       return(result);    double distance=entry_price*(percent/100.0);    if(is_buy)       result.price=NormalizePrice(entry_price-distance);    else       result.price=NormalizePrice(entry_price+distance); //--- Adjust for stops level    result.price=AdjustForStopsLevel(result.price,entry_price,is_buy); //--- Calculate final distances    result.distance_points=MathAbs(entry_price-result.price)/m_point;    result.distance_pips=result.distance_points/(m_pip_size/m_point);    result.valid=true;    return(result); //+------------------------------------------------------------------+ //| Calculate take profit based on risk:reward ratio                 | //+------------------------------------------------------------------+ double CStopLossManager::CalculateTakeProfit(const bool is_buy,                                              const double entry_price,                                              const double sl_price,                                              const double rr_ratio=2.0)    double sl_distance=MathAbs(entry_price-sl_price);    double tp_distance=sl_distance*rr_ratio;    if(is_buy)       return(NormalizePrice(entry_price+tp_distance));    else       return(NormalizePrice(entry_price-tp_distance)); //+------------------------------------------------------------------+ //| Universal trailing stop calculation                              | //+------------------------------------------------------------------+ double CStopLossManager::CalculateTrailingStop(const ENUM_TRAIL_METHOD method,                                                const bool is_buy,                                                const double entry_price,                                                const double current_sl,                                                const double current_price,                                                const double param1=0.0,                                                const double param2=0.0)    if(!m_initialized)       return(current_sl);    switch(method)       case TRAIL_NONE:          return(current_sl);       case TRAIL_FIXED:          return(TrailFixed(is_buy,current_sl,current_price,param1>0 ? param1 : 20.0));       case TRAIL_ATR:          return(TrailATR(is_buy,current_sl,current_price,param1>0 ? param1 : 2.0));       case TRAIL_STEP:          return(TrailStep(is_buy,entry_price,current_sl,current_price,param1>0 ? param1 : 10.0));       case TRAIL_BREAKEVEN:          return(TrailBreakeven(is_buy,entry_price,current_sl,current_price,                                param1>0 ? param1 : 20.0,param2>0 ? param2 : 2.0));    return(current_sl); //+------------------------------------------------------------------+ //| Fixed distance trailing stop                                     | //+------------------------------------------------------------------+ double CStopLossManager::TrailFixed(const bool is_buy,                                     const double current_sl,                                     const double current_price,                                     const double trail_distance_pips)    double distance=trail_distance_pips*m_pip_size;    double new_sl;    if(is_buy)       new_sl=NormalizePrice(current_price-distance);       if(new_sl>current_sl)          return(new_sl);    else       new_sl=NormalizePrice(current_price+distance);       if(new_sl<current_sl || current_sl==0)          return(new_sl);    return(current_sl); //+------------------------------------------------------------------+ //| ATR-based trailing stop                                          | //+------------------------------------------------------------------+ double CStopLossManager::TrailATR(const bool is_buy,                                   const double current_sl,                                   const double current_price,                                   const double atr_multiplier=2.0)    double atr=GetATRValue(0);    if(atr==0)       return(current_sl);    double distance=atr*atr_multiplier;    double new_sl;    if(is_buy)       new_sl=NormalizePrice(current_price-distance);       if(new_sl>current_sl)          return(new_sl);    else       new_sl=NormalizePrice(current_price+distance);       if(new_sl<current_sl || current_sl==0)          return(new_sl);    return(current_sl); //+------------------------------------------------------------------+ //| Step trailing stop                                               | //+------------------------------------------------------------------+ double CStopLossManager::TrailStep(const bool is_buy,                                    const double entry_price,                                    const double current_sl,                                    const double current_price,                                    const double step_pips=10.0)    double step=step_pips*m_pip_size;    double profit_distance;    int steps_in_profit;    if(is_buy)       profit_distance=current_price-entry_price;       if(profit_distance<=0)          return(current_sl);       steps_in_profit=(int)MathFloor(profit_distance/step);       if(steps_in_profit>0)          double new_sl=NormalizePrice(entry_price+(steps_in_profit-1)*step);          if(new_sl>current_sl)             return(new_sl);    else       profit_distance=entry_price-current_price;       if(profit_distance<=0)          return(current_sl);       steps_in_profit=(int)MathFloor(profit_distance/step);       if(steps_in_profit>0)          double new_sl=NormalizePrice(entry_price-(steps_in_profit-1)*step);          if(new_sl<current_sl || current_sl==0)             return(new_sl);    return(current_sl); //+------------------------------------------------------------------+ //| Breakeven trailing stop                                          | //+------------------------------------------------------------------+ double CStopLossManager::TrailBreakeven(const bool is_buy,                                         const double entry_price,                                         const double current_sl,                                         const double current_price,                                         const double trigger_pips=20.0,                                         const double be_offset_pips=2.0)    double trigger=trigger_pips*m_pip_size;    double offset=be_offset_pips*m_pip_size;    if(is_buy)       //--- Check if price has moved enough to trigger breakeven       if(current_price-entry_price>=trigger)          double be_level=NormalizePrice(entry_price+offset);          if(be_level>current_sl)             return(be_level);    else       //--- Check if price has moved enough to trigger breakeven       if(entry_price-current_price>=trigger)          double be_level=NormalizePrice(entry_price-offset);          if(be_level<current_sl || current_sl==0)             return(be_level);    return(current_sl); //+------------------------------------------------------------------+ //| Convert pips to points                                           | //+------------------------------------------------------------------+ double CStopLossManager::PipsToPoints(const double pips)    return(pips*(m_pip_size/m_point)); //+------------------------------------------------------------------+ //| Convert points to pips                                           | //+------------------------------------------------------------------+ double CStopLossManager::PointsToPips(const double points)    if(m_pip_size==0)       return(0);    return(points/(m_pip_size/m_point)); //+------------------------------------------------------------------+ //| Convert pips to price distance                                   | //+------------------------------------------------------------------+ double CStopLossManager::PipsToPrice(const double pips)    return(pips*m_pip_size); //+------------------------------------------------------------------+

ASQ Recovery Engine

ASQ Recovery Engine v1.2 — Free, Open-Source You just lost 3 trades in a row. Your next move determines whether you lose 3 more or recover. ASQ Recovery Engine automatically reduces your risk after consecutive losses, gradually restores it after wins, and blocks the revenge trades and martingale impulses that blow accounts. It tracks your emotional state, scores your session stress level, and tells you when to stop trading.

FEATURES: - Automatic risk reduction after consecutive losses with gradual restoration after wins - Revenge trading guard — blocks trades placed within 2 minutes of a loss (configurable) - Martingale guard — prevents lot size increases after 2+ consecutive losses - Session heat score — 0-100 stress gauge that rises on losses and decays on wins - Emotional state tracking — Calm, Focused (streak), Stressed (losing), Tilted (3+ losses), Reckless (revenge detected) - Auto-conservative switch — automatically switches to Conservative mode when session drawdown exceeds threshold - Cooling-off periods after big losses (configurable duration and threshold) - Win streak capitalization with bonus multiplier - Anti-tilt protection — defensive mode reduces risk to minimum at 3+ losses - Trade mini-log — last 10 results with W/L, profit, and risk multiplier at time of trade - 3 presets — Conservative (slow recovery, long cooling), Moderate, Aggressive (fast recovery, streak bonus) - Daily reset option with mode restoration

DEMO EA INCLUDED: Attach to any chart — automatically detects closed trades from account history: — Recovery state and emotional state indicators — Heat score gauge with progress bar (green→yellow→red) — Risk multiplier, adjusted risk %, and adjusted lot size — Consecutive wins/losses with max tracking — Session W/L count and P/L — Trade log (last N results as W/L sequence) — Revenge guard status with daily block counter — Martingale guard status — Cooling timer and trading allowed/blocked indicator — Contextual recommendation messages USAGE: #include "ASQ_RecoveryEngine.mqh" CASQRecoveryEngine recovery; recovery.Initialize(1.0, 0.01, AccountBalance()); recovery.SetMode(ASQ_RECOVERY_MODERATE); recovery.OnTradeWin(profit, pips);    // After each win recovery.OnTradeLoss(loss, pips);     // After each loss double adjRisk = recovery.GetAdjustedRisk(); double adjLot  = recovery.GetAdjustedLot(); Place both files in the same folder — compiles instantly, no subfolder setup needed. FILES: - ASQ_RecoveryEngine.mqh — Library (748 lines) - ASQ_RecoveryEngine_Demo.mq5 — Demo EA (354 lines) MetaTrader 5, all brokers, all instruments, all timeframes. Free and open-source. 1,102 lines of production MQL5. AlgoSphere Quant — Precision before profit.

ASQ PropFirm Shield

ASQ PropFirm Shield v1.2 — Free, Open-Source

One blown drawdown limit and your $100K challenge is gone. ASQ PropFirm Shield monitors every tick against your firm's exact rules — daily loss limits, maximum drawdown (standard or trailing), profit targets, consistency scores, and minimum trading days. It calculates exactly how much you can risk on the next trade without breaching anything. Built-in presets for 7 prop firms mean you drop it in and it just works.

FEATURES: - 7 built-in prop firm presets — FTMO, MyForexFunds, Funded Next, The Funded Trader, E8 Funding, Bulenox, TopStep - Daily loss limit enforcement — auto-blocks trading when daily limit is hit - Maximum drawdown protection — standard or trailing, with floor lock for funded accounts - 5-level shield state — Safe, Caution (>50% used), Danger (>80%), Breached (daily hit), Failed (max DD) - Emergency close-all flag — triggers at 90% of any limit, recommends immediate position closure - Risk-per-trade guardrail — WouldExceedRiskPerTrade() prevents oversized entries - Safe risk amount calculator — returns the max $ you can risk on the next trade without breaching anything - Profit target tracking with progress percentage - Win rate & profit factor — live tracking from OnTradeClose() calls - Consistency score calculation for firms that require it (MFF, FundedNext, Bulenox) - Minimum trading day requirements with completion tracking - Weekend holding prevention with Friday evening cutoff - Challenge phase detection — Challenge, Verification, Funded with auto-target adjustment - Daily PnL history (last 10 days) DEMO EA INCLUDED: Attach to any chart to see the full dashboard: — Firm name, phase, and shield state with color coding — Profit target progress bar (green) — Daily loss limit progress bar (green→yellow→red as limit approaches) — Max drawdown progress bar with trailing DD indicator — Win rate, profit factor, trading days, and safe risk amount — Emergency warning panel with close-all alert — Status message and remaining limits in $ and %

USAGE: #include "ASQ_PropFirmShield.mqh" CASQPropFirmShield prop; prop.Initialize(AccountBalance(), ASQ_PROP_FTMO); prop.Update(equity, balance);                      // Call every tick double safe = prop.GetSafeRiskAmount();            // Max safe $ to risk Place both files in the same folder — compiles instantly, no subfolder setup needed. FILES: - ASQ_PropFirmShield.mqh — Library (756 lines) - ASQ_PropFirmShield_Demo.mq5 — Demo EA (317 lines) MetaTrader 5, all brokers, all instruments, all timeframes. Free and open-source. 1,073 lines of production MQL5. AlgoSphere Quant — Precision before profit.

ASQ Indicator Manager

Stop managing 11 separate iMA/iATR/iRSI handles with 50+ lines of boilerplate. ASQ Indicator Manager wraps 11 built-in indicators into one class with automatic handle creation, bar-based caching, trend voting, market regime classification, and clean getter methods. Three lines replace your entire indicator setup.

FEATURES: - 11 managed indicators — 3 Moving Averages (EMA fast/med, SMA slow), 3 ATRs (fast 7, standard 14, slow 50), RSI, Stochastic K/D, CCI, MACD (main/signal/histogram), ADX (+DI/-DI) - Bar-based caching — Update() only copies buffers when a new bar forms. Cached values returned instantly between bars. ForceUpdate() for tick-level precision - Automatic handle creation and release — CreateHandles() on init, ReleaseHandles() on deinit, no leaks - Configurable periods for all indicators — SetMAPeriods(), SetRSIPeriod(), SetATRPeriod(), SetADXPeriod(), SetStochSettings(), SetCCIPeriod() - Trend direction voting — MA alignment + DI crossover + MACD histogram. 2+ votes = confirmed direction (+1/-1/0) - Market regime classification — 5 regimes: Trending Up, Trending Down, Ranging, Volatile (ATR ratio > 1.5x), Quiet (< 0.5x) - Overbought/oversold detection — RSI > 70 or StochK > 80 = overbought, RSI < 30 or StochK < 20 = oversold - Volatility ratio — ATR fast / ATR slow for regime detection - Trend strength — ADX value, IsTrending() (ADX > 25), IsRanging() (ADX < 20) - Shift support — all getters accept shift parameter for historical lookback DEMO INDICATOR INCLUDED: Drop on any chart to see a live dashboard showing all 11 indicator values organized by category (MAs, Oscillators, ADX/ATR), plus trend direction, market regime, OB/OS status, volatility ratio, and trending/ranging mode.

USAGE: #include "ASQ_IndicatorManager.mqh" CASQIndicatorManager ind; ind.SetMAPeriods(8, 21, 50); ind.Initialize(_Symbol, PERIOD_M5); ind.Update();                          // Call on every tick double rsi = ind.GetRSI(); int trend = ind.GetTrendDirection();   // +1, -1, or 0 Place both files in the same folder — compiles instantly, no subfolder setup needed. This is the open-source indicator engine behind Quant Cristina on the MQL5 Market. Same logic, same accuracy. FILES: - ASQ_IndicatorManager.mqh — Library (325 lines) - ASQ_IndicatorManager_Demo.mq5 — Demo indicator (238 lines) MetaTrader 5, all brokers, all instruments, all timeframes. Free and open-source. 563 lines of production MQL5. AlgoSphere Quant — Precision before profit.

ASQ Risk Analytics Engine

This is what quant desks run after every trading session — and now it's free. ASQ Risk Analytics gives your EA Monte Carlo simulations, Value at Risk, Kelly Criterion position sizing, and 12+ risk-adjusted performance metrics. Feed it your trade history and it tells you exactly how risky your system is, how much to risk per trade, and whether you should keep trading at all.

ANALYSIS MODULES: - Monte Carlo simulation — 1,000 to 10,000 bootstrap runs. Expected return, expected max drawdown, probability of ruin, and 95% confidence intervals for both return and drawdown - Value at Risk (VaR) — Historical VaR at 95% and 99% confidence. Expected Shortfall (CVaR) at both levels. Daily, weekly, and monthly VaR scaling - Position sizing — 7 methods: Fixed, Percent Risk, Kelly Criterion (full), Half Kelly (recommended), Optimal F, ATR-Based, VaR-Constrained. All normalized to broker lot limits - Risk-adjusted ratios — Sharpe, Sortino, Calmar, Sterling, System Quality Number (SQN), Ulcer Index, Ulcer Performance Index, Recovery Factor, Payoff Ratio, K-Ratio - Performance metrics — Win rate, profit factor, expectancy ($), expectancy (R), max consecutive wins/losses, total return, annualized return - Risk assessment — 6-level risk classification (Minimal to Extreme), risk score 0-100, trading recommendation engine, probability of ruin at configurable thresholds, consecutive loss probability calculator CONVENIENCE: - LoadFromAccount() — one call loads all closed trades from account history. No manual loop needed. Symbol filter and max trades supported. DEMO SCRIPT INCLUDED: Drag onto any chart — reads your account history and generates a full institutional risk report in the Experts log: — Performance summary (trades, win rate, PF, expectancy, return) — Risk ratios (Sharpe, Sortino, Calmar, SQN, Ulcer, Recovery Factor) — Monte Carlo results (expected return, expected DD, P(ruin), 95% CI) — VaR/CVaR at 95% and 99% — Position sizing comparison (Kelly, Half Kelly, Optimal F, VaR-constrained) — Consecutive loss probabilities (3 through 10 in a row) — Risk of ruin at 10/20/30/50% drawdown thresholds — Final assessment with trading recommendation

USAGE: #include "ASQ_RiskAnalytics.mqh" CASQRiskAnalytics risk; risk.Initialize(_Symbol, pipValue); risk.LoadFromAccount();              // Load all closed trades risk.Calculate();                     // Run everything Print(risk.ExportAnalytics());        // Full report risk.CalculatePositionSize(balance, stopPips); double lot = risk.GetHalfKellyLot(); // Recommended sizing Place both files in the same folder — compiles instantly, no subfolder setup needed. FILES: - ASQ_RiskAnalytics.mqh — Library (915 lines) - ASQ_RiskAnalytics_Demo.mq5 — Demo script (136 lines) MetaTrader 5, all brokers, all instruments, all timeframes. Free and open-source. 1,051 lines of production MQL5. Zero external dependencies. Pure MQL5 mathematics. AlgoSphere Quant — Precision before profit.

ASQ Trade Frequency Controller

Your EA's signal logic is good — but some days it trades too much, other days too little. ASQ Frequency Controller scales 8 filter parameters simultaneously with a single factor, letting you dial trade frequency up or down without touching your entry logic. Switch between Ultra-Conservative and Scalper mode with one button. The auto-frequency mode reads ATR and adjusts for you.

FEATURES: - 5 frequency modes — Ultra-Conservative (0.5x), Conservative (0.75x), Normal (1.0x), Aggressive (1.5x), Scalper (2.0x) - 8 filter parameters scaled dynamically — cooldown, spread tolerance, ATR range, min bars, min distance, signal strength thresholds - Runtime +/- fine-tuning with configurable step size - Auto-frequency from volatility — pass current ATR, frequency adapts to market conditions automatically - Daily trade limiter — SetMaxTradesPerDay() caps entries, auto-resets at midnight - Effective values snapshot — GetSnapshot() returns all scaled values in a single struct for dashboard use - Interactive chart buttons — click to switch modes or fine-tune factor - Safe floors on signal thresholds — strength never drops below 0.2/0.3 even at 3.0x HOW THE SCALING WORKS: Higher frequency factor = MORE trades accepted: — Cooldown: divided (shorter wait between trades) — Max spread: multiplied (wider spreads accepted) — Min ATR: divided (lower volatility accepted) — Min bars: divided (fewer bars between entries) — Min distance: divided (closer to existing positions) — Signal strength: divided by sqrt (weaker signals accepted, with floor)

DEMO EA INCLUDED: Attach to any chart for the interactive dashboard: — Mode selector with 5 buttons (UC/CONS/NORM/AGGR/SCALP) plus +/- fine-tuning — Frequency factor visualization bar — Base vs Effective comparison table for all 8 filter parameters — Daily trade counter with remaining trades — Auto-frequency status USAGE: #include "ASQ_FrequencyControl.mqh" CASQFrequencyControl freq; freq.Initialize(1.0, 0.25, 0.25, 3.0); freq.SetBaseFilters(60, 1.5, 0.3, 5.0, 3, 10.0, 0.5, 0.6); freq.SetMode(ASQ_FREQ_NORMAL); freq.SetMaxTradesPerDay(10); int cooldown = freq.GetEffectiveCooldownSec(); Place both files in the same folder — compiles instantly, no subfolder setup needed. This is the open-source frequency engine behind Quant Cristina on the MQL5 Market. Same logic, same accuracy. FILES: - ASQ_FrequencyControl.mqh — Library (438 lines) - ASQ_FrequencyControl_Demo.mq5 — Demo EA (277 lines) MetaTrader 5, all brokers, all instruments, all timeframes. Free and open-source. 715 lines of production MQL5. AlgoSphere Quant — Precision before profit.

ASQ Telegram Notifier

FEATURES: - Trade open/close/modify notifications with entry, SL, TP, and P/L - Daily and weekly P/L summaries with win rate, drawdown, and balance - EA startup and shutdown alerts (know when your EA goes online/offline) - Error, warning, signal, and custom message support - Message queue with retry — 10-slot buffer, 3 auto-retries on failure - Silent hours — suppress notifications during configurable GMT hours - Daily message stats (sent/failed counters, auto-reset at midnight) - Markdown formatting with tag labels ([OPEN], [CLOSE], [DAILY], etc.) - URL encoding and Markdown character escaping - WebRequest-based — fully MQL5 Market compliant, no DLLs SETUP (3 steps): DEMO EA INCLUDED: Attach to any chart with your credentials: — Sends test message and startup notification on initialization — Auto-detects closed trades and sends close notifications — Sends shutdown notification with session P/L on EA removal — Dashboard shows connection status (Verified/Connected/Not Configured), daily send/error counts, queue status, total messages, and last error

USAGE: tg.Initialize("YOUR_BOT_TOKEN", "YOUR_CHAT_ID", _Symbol); tg.AddChatId("GROUP_CHAT_ID");              // Optional 2nd chat tg.SetSilentHours(true, 22, 6);             // No buzzing at night tg.VerifyConnection();                       // Check bot token tg.SendStartup();                            // EA is live tg.SendTradeOpen(_Symbol, "BUY", 0.10, ask, sl, tp); tg.Update();                                 // Process queue (call periodically) Place both files in the same folder — compiles instantly, no subfolder setup needed. This is the open-source notification engine behind Quant Cristina on the MQL5 Market. Same logic, same accuracy. FILES: MetaTrader 5, all brokers, all instruments, all timeframes. Free and open-source. 964 lines of production MQL5. AlgoSphere Quant — Precision before profit.
RobotFX does not own any of the code provided on this platform. All tools are freely available on the internet; we simply index and re-offer them for download. We are not responsible for any financial losses that may occur. Trading responsibilities rely solely on the traders downloading and using the displayed Expert Advisors, indicators, and scripts. These tools are provided for educational purposes only and may require modification or optimization to align with a trader's specific strategy or needs.
© ROBOTFX - Best MetaTrader Expert Advisors & Indicators