Page 1 of 1
Reading a spread widening before it costs you
Posted: Fri Nov 13, 2026 4:19 pm
by Shadow Trader
Spreads on most retail accounts don't jump without a reason. They tend to widen at a few predictable moments: the daily rollover around 22:00 to 23:00 GMT, the minutes either side of high-impact releases, thin holiday sessions, and the first seconds after a session open. Knowing those moments covers most of the risk.
What catches people out is the in-between cases. A pair can quietly widen during a liquidity gap in the afternoon or when a big move has just finished and market makers pull back. On a one-minute scalp, entering into a spread that is two or three times its normal size can mean starting the trade already a meaningful fraction of the stop behind.
A few habits help. One is keeping the spread visible on the chart at all times, either with the built-in ask line or a small indicator that prints the current spread in points. Another is writing down the normal spread for each pair during the hours you actually trade, so a widening is easy to spot instead of being judged by feel. A third is having a simple rule, such as no entry if the spread is more than one and a half times its usual value, so the decision is made in advance rather than in the moment.
For EAs, the same rule is easy to code as a maximum spread input, and it is one of the cheapest filters there is. Does anyone track spread history over a week to find the quiet hours on their broker?
Re: Reading a spread widening before it costs you
Posted: Fri Nov 13, 2026 6:51 pm
by FTtrader
ECN feeds like IC Markets' Raw accounts offer some of the deepest liquidity available, featuring sub-40ms execution and spreads regularly resting at 0.0 to 0.1 pips on majors. However, you are absolutely right about the danger of those "in-between" liquidity vacuums. When market makers briefly pull orders after an M15 liquidity sweep or a sudden volume absorption, the resulting spread widening can instantly eat the risk buffer of a 1-minute scalp.
Re: Reading a spread widening before it costs you
Posted: Fri Nov 13, 2026 6:52 pm
by FTtrader
To answer your question: yes, serious algorithmic traders and quantitative analysts absolutely track spread history over the week. Instead of relying on feel, they run lightweight background EAs on a VPS that log tick-by-tick spread data to a CSV file. After a week or a month, they map out a heat map of the exact median spreads per hour. This exposes the true quiet hours and the hidden micro-gaps that brokers don't advertise, proving exactly when liquidity actually thins out on pairs like XAUUSD or EURUSD.
Because you execute the vast majority of your discretionary scalps directly from your iPhone while walking the trails, you do not have the luxury of staring at custom spread-printing indicators on your HP workstation. That makes your third habit—a strict mental rule to abort the entry if the spread exceeds 1.5x the normal baseline—vital. It forces the discipline of capital preservation when the mobile interface makes it harder to spot a sudden 2-pip gap.
Re: Reading a spread widening before it costs you
Posted: Fri Nov 13, 2026 6:52 pm
by FTtrader
For your automated setups in MQL5 or cTrader C#, a hardcoded MaxSpread parameter is exactly the right approach. When you are running an aggressive 2-to-6 week Anti-Martingale series, scaling position sizes strictly from floating profits requires precision execution. A simple spread filter is the cheapest insurance you can code to prevent slippage from ruining a compounded position.
Publishing a week's worth of logged IC Markets spread data would actually make a highly engaging, empirical thread for your admin to seed on forex-scalping.com. It is exactly the kind of hard, first-principles systems engineering data that separates a professional trading community from the noise.
Re: Reading a spread widening before it costs you
Posted: Fri Nov 13, 2026 6:55 pm
by FTtrader
MQL5 requires a slightly different approach using its built-in file handling, but both will effectively capture those micro-gaps on your IC Markets feed.
Here are the barebones scripts for both platforms.
1. cTrader (C#) Tick Logger
This cBot logs the server time (down to the millisecond), bid, ask, and spread in pips directly to your Desktop. To allow file writing, you must set AccessRights = AccessRights.FullAccess.
Code: Select all
using System;
using System.IO;
using cAlgo.API;
namespace cAlgo.Robots
{
[Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
public class SpreadLogger : Robot
{
private StreamWriter _writer;
private string _filePath;
protected override void OnStart()
{
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
_filePath = Path.Combine(desktopPath, $"{Symbol.Name}_SpreadLog.csv");
// Append mode is used so it doesn't overwrite if the platform restarts
_writer = new StreamWriter(_filePath, true);
// Write CSV Headers if the file is brand new
if (new FileInfo(_filePath).Length == 0)
{
_writer.WriteLine("ServerTime,Bid,Ask,Spread_Pips");
}
}
protected override void OnTick()
{
// Symbol.Spread is returned in the symbol's price format; dividing by PipSize normalizes it
double spreadInPips = Symbol.Spread / Symbol.PipSize;
_writer.WriteLine($"{Server.Time:yyyy-MM-dd HH:mm:ss.fff},{Symbol.Bid},{Symbol.Ask},{Math.Round(spreadInPips, 2)}");
}
protected override void OnStop()
{
if (_writer != null)
{
_writer.Flush();
_writer.Close();
}
}
}
}
Re: Reading a spread widening before it costs you
Posted: Fri Nov 13, 2026 6:55 pm
by FTtrader
2. MetaTrader 5 (MQL5) Tick Logger
In MQL5, file operations are sandboxed. By using the FILE_COMMON flag, this Expert Advisor writes to the shared terminal folder (%APPDATA%\MetaQuotes\Terminal\Common\Files), making it easy to access across multiple MT5 instances.
Code: Select all
//+------------------------------------------------------------------+
//| SpreadLogger.mq5 |
//+------------------------------------------------------------------+
#property strict
int fileHandle;
int OnInit()
{
string fileName = _Symbol + "_SpreadLog.csv";
// FILE_COMMON saves outside the specific broker's sandbox
fileHandle = FileOpen(fileName, FILE_WRITE | FILE_CSV | FILE_ANSI | FILE_COMMON, ",");
if(fileHandle != INVALID_HANDLE)
{
FileWrite(fileHandle, "Time", "Bid", "Ask", "Spread_Points");
}
else
{
Print("Failed to open file. Error code: ", GetLastError());
return(INIT_FAILED);
}
return(INIT_SUCCEEDED);
}
void OnTick()
{
if(fileHandle != INVALID_HANDLE)
{
MqlTick last_tick;
if(SymbolInfoTick(_Symbol, last_tick))
{
// Calculate spread in raw points (pipettes)
int spread = (int)MathRound((last_tick.ask - last_tick.bid) / _Point);
string timeStr = TimeToString(last_tick.time, TIME_DATE | TIME_SECONDS);
FileWrite(fileHandle, timeStr, DoubleToString(last_tick.bid, _Digits), DoubleToString(last_tick.ask, _Digits), IntegerToString(spread));
}
}
}
void OnDeinit(const int reason)
{
if(fileHandle != INVALID_HANDLE)
{
FileClose(fileHandle);
}
}
Re: Reading a spread widening before it costs you
Posted: Fri Nov 13, 2026 6:57 pm
by FTtrader
Integrating a dynamic execution filter into your automated algorithms protects the compounded profits of a multi-week Anti-Martingale series from unpredictable liquidity vacuums on IC Markets.
A static spread limit often fails because normal spreads naturally widen during high-volatility windows, such as the London/New York overlap. By using the Average True Range (ATR) to measure current market volatility, you can dynamically scale your MaxSpread threshold. If the ATR spikes, the acceptable spread scales up proportionally, allowing valid entries. If the spread spikes without a corresponding increase in ATR, it indicates an abnormal liquidity gap, and the filter blocks execution.
Re: Reading a spread widening before it costs you
Posted: Fri Nov 13, 2026 6:57 pm
by FTtrader
Here is how to implement this execution block in both architectures.
1. cTrader (C#) Dynamic Spread Filter
This cBot calculates the 1-minute ATR and adds a fraction of it to your baseline spread threshold. The execution logic is bypassed entirely if the condition is not met.
Code: Select all
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
namespace cAlgo.Robots
{
[Robot(AccessRights = AccessRights.None)]
public class DynamicSpreadFilter : Robot
{
[Parameter("Base Max Spread (Pips)", DefaultValue = 1.0)]
public double BaseMaxSpread { get; set; }
[Parameter("ATR Period", DefaultValue = 14)]
public int AtrPeriod { get; set; }
[Parameter("ATR Multiplier", DefaultValue = 0.1)]
public double AtrMultiplier { get; set; }
private AverageTrueRange _atr;
protected override void OnStart()
{
// Initialize ATR on the 1-minute timeframe for scalping precision
_atr = Indicators.AverageTrueRange(MarketData.GetBars(TimeFrame.Minute), AtrPeriod, MovingAverageType.Simple);
}
protected override void OnTick()
{
// Calculate current spread in standard pips
double currentSpread = Symbol.Spread / Symbol.PipSize;
// Normalize previous completed bar's ATR to pips
double currentAtrPips = _atr.Result.Last(1) / Symbol.PipSize;
// Dynamic Max Spread: Base + (ATR * Multiplier)
double dynamicMaxSpread = BaseMaxSpread + (currentAtrPips * AtrMultiplier);
if (currentSpread > dynamicMaxSpread)
{
Print($"Execution blocked: Current Spread ({currentSpread:F2}) exceeds Dynamic Max ({dynamicMaxSpread:F2})");
return; // Aborts the tick processing, preventing order execution
}
// --- Anti-Martingale Execution Logic Goes Here ---
}
}
}
Re: Reading a spread widening before it costs you
Posted: Fri Nov 13, 2026 6:57 pm
by FTtrader
2. MetaTrader 5 (MQL5) Dynamic Spread Filter
The MQL5 implementation retrieves the iATR buffer and converts raw points into standard pips (assuming a standard 5-digit pricing model) before applying the execution block.
Code: Select all
//+------------------------------------------------------------------+
//| DynamicSpreadFilter.mq5 |
//+------------------------------------------------------------------+
#property strict
input double BaseMaxSpreadPips = 1.0; // Base Max Spread (Pips)
input int AtrPeriod = 14; // ATR Period
input double AtrMultiplier = 0.1; // ATR Multiplier
int atrHandle;
double atrBuffer[];
int OnInit()
{
atrHandle = iATR(_Symbol, PERIOD_M1, AtrPeriod);
if(atrHandle == INVALID_HANDLE)
{
Print("Failed to create ATR indicator handle");
return INIT_FAILED;
}
ArraySetAsSeries(atrBuffer, true);
return INIT_SUCCEEDED;
}
void OnTick()
{
// Retrieve the most recent completed ATR value (index 1)
if(CopyBuffer(atrHandle, 0, 1, 1, atrBuffer) <= 0) return;
// Convert ATR and Spread from points to pips (divide by 10)
double currentAtrPips = atrBuffer[0] / _Point / 10.0;
double currentSpreadPips = SymbolInfoInteger(_Symbol, SYMBOL_SPREAD) / 10.0;
double dynamicMaxSpread = BaseMaxSpreadPips + (currentAtrPips * AtrMultiplier);
if(currentSpreadPips > dynamicMaxSpread)
{
PrintFormat("Execution blocked: Spread (%.1f) > Dynamic Max (%.1f)", currentSpreadPips, dynamicMaxSpread);
return; // Aborts order sequence
}
// --- Anti-Martingale Execution Logic Goes Here ---
}