Voir comment télécharger gratuitement des robots de trading
Retrouvez-nous sur Telegram !
Rejoignez notre page de fans
Un script intéressant ?
Poster un lien vers celui-ci -
laisser les autres l'évaluer
Vous avez aimé le script ? Essayez-le dans le terminal MetaTrader 5
Indicateurs

Broker Rollover Spread Logger and EA Guard - indicateur pour MetaTrader 5

Vues:
300
Note:
(4)
Publié:
MQL5 Freelance Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance

If you're holding positions or running automated EAs across the daily server rollover (usually 23:55 to 00:10 server time), you've probably seen liquidity dry up and bid-ask spreads jump 5x to 15x in a few seconds. Mid-price barely moves. Yet a single Ask spike can trigger a pending Buy Stop, clip a tight stop-loss on a short trade, or drag floating equity below a prop firm's daily loss limit right at midnight.

I built Broker Rollover Spread Logger to track those midnight spikes tick-by-tick and give EAs a clean pause signal. When you attach it to a chart, it scans up to 240 historical bars outside the rollover window to seed an immediate daytime baseline spread (capped at 50 points during seeding so old news spikes don't skew the average). During normal hours, it updates that baseline using an outlier-filtered exponential average. Once the clock hits your rollover window, any tick exceeding InpSpikeMultiplier (default 3.0x baseline) and InpMinSpikePts flips iCustom Buffer 0 to 1.0 .


iCustom Buffers and Telemetry

Your EA only needs to read bar index 0 via CopyBuffer . The indicator exposes three buffers and writes a summary line when the rollover window closes:

  • Buffer 0 ( ExtGuardFlagBuf ): Returns 1.0 (BLOCK) on the current bar during rollover when live spread breaches your limit, and 0.0 (SAFE) otherwise.
  • Buffer 1 ( ExtCurSpreadBuf ): Current Bid-Ask spread in points on every tick.
  • Buffer 2 ( ExtPeakSpreadBuf ): Highest spread recorded during the active or most recent rollover session.

If InpWriteCsvLog is enabled, it also appends the date, peak points, peak timestamp, baseline spread, and spike ratio to MQL5/Files/Rollover_Spread_Log_<Symbol>.csv so you can audit your broker's midnight execution over weeks of live trading. Global variables keep the baseline intact across timeframe changes (expiring automatically if stale for more than 48 hours).

EA Integration Snippet (MQL5)

int g_rolloverGuardHandle = INVALID_HANDLE;

int OnInit()
  {
   g_rolloverGuardHandle = iCustom(_Symbol, _Period, "Broker_Rollover_Spread_Logger");
   if(g_rolloverGuardHandle == INVALID_HANDLE)
      return(INIT_FAILED);
   return(INIT_SUCCEEDED);
  }

bool IsRolloverSpreadSafe()
  {
   double flag[1];
   if(CopyBuffer(g_rolloverGuardHandle, 0, 0, 1, flag) <= 0)
      return(true);
   return(flag[0] < 0.5); // false when Buffer 0 == 1.0 (BLOCK)
  }

Input Parameters

Parameter Default Description
InpRolloverStartHour 23 Rollover window start hour (Broker Server Time, 0-23).
InpRolloverStartMin 55 Rollover window start minute (0-59).
InpRolloverEndHour 0 Rollover window end hour (Broker Server Time, 0-23).
InpRolloverEndMin 10 Rollover window end minute (0-59).
InpSpikeMultiplier 3.0 Spike alert threshold as a multiplier of daytime baseline spread.
InpMinSpikePts 25 Minimum spread in points required before triggering a spike flag.
InpMaxSafeSpreadPts 0 Optional hard spread cap in points ( 0 = disabled, uses multiplier).
InpLogToExperts true Prints spike alerts and end-of-window summaries to the Experts log.
InpWriteCsvLog false Appends daily rollover summaries to MQL5/Files/Rollover_Spread_Log_<Symbol>.csv .
InpSaveGlobalVar true Saves baseline and peak values in terminal GlobalVariables across chart reloads.
InpPanelX 20 Top-right HUD horizontal pixel offset.
InpPanelY 20 Top-right HUD vertical pixel offset.

Technical Scope

This tool covers live, single-symbol rollover spread tracking and iCustom EA gating. It doesn't reconstruct historical M1 equity curves across multiple symbols, calculate Central European Time (Prague 00:00 CE(S)T) High-Water Marks from HTML Strategy Tester reports, or run static source code checks. If you want to audit backtest reports against prop firm daily drawdown rules before going live, or need an automated equity and news circuit breaker that flattens open trades prior to a breach, see the risk tools on my MQL5 profile.

Risk and Stop-Loss Calculator Risk and Stop-Loss Calculator

When I first started scalping, I had a problem: during periods of high volatility, it sometimes took too long to calculate exactly 1%, and I’d end up setting an incorrect stop-loss or using a position size that was too low or too high. But with this calculator, I can do it much faster—I just have to drag a line to the stop-loss zone, and it automatically calculates the position size I should use for my 1%. I hope you find it very useful!

Moving Average Crossover EA Gold Moving Average Crossover EA Gold

Moving average crossover EA for Gold (XAUUSD), forex and any symbol: one position per cross of two moving averages on the closed bar, exit on the opposite cross, stop loss, take profit and breakeven in points. Open source code.

Order Blocks Zones SMC Order Blocks Zones SMC

Order block indicator for MT5 on Gold (XAUUSD), forex and indices: the last opposite candle before a move that breaks a swing becomes a zone, fresh, tested and broken states, closed bars only. Open source code.

G7 Pro Trade Manager and Prop Firm Equity Protector Auto-BE Trailing Stop 1-Click HUD) G7 Pro Trade Manager and Prop Firm Equity Protector Auto-BE Trailing Stop 1-Click HUD)

G7 Pro Trade Manager & Prop Firm Equity Protector is a professional on-chart trading assistant for manual traders and prop firm accounts (FTMO, FundedNext, The5ers). It features a clean obsidian HUD dashboard directly on the MT5 chart with 1-click execution, automated breakeven shield, dynamic trailing stop, and a daily loss circuit breaker to protect your funded account. Compatible with all pairs and accounts.