Loading…

Session Open Execution Damper

The first few minutes after a session opens - Tokyo, London, New York, or any other configured open - are reliably the worst time to send an order with a normal-hours slippage and stop setting: quotes gap, spreads jump, and a tolerance that is fine at 11am gets requoted or rejected at the open. This EA tracks up to four configurable session-open hours in broker server time and treats a window after each one (InpDampWindowMinutes long) as a damp window. Two ways to handle that window, chosen with InpMode. MODE_POSTPONE holds an order back until the window has cleared, the same idea as waiting out a red-news spike. MODE_WIDEN sends immediately but with slippage multiplied up and the stop/target distance floored against the symbol's own MODE_STOPLEVEL plus a configured buffer, so a normal-hours setting that would be too tight during the open does not get the order rejected outright. InpStandaloneMode chooses whether this EA acts on its own two chart buttons directly, or only publishes SOD_ChaosActive, SOD_SuggestedSlippagePoints and SOD_SuggestedStopBufferPoints as terminal global variables for another EA to read and apply to its own OrderSend calls. Session open hours are broker-server-time hours the trader sets by hand, because MQL4 has no built-in trading-session calendar and every broker's server offset from GMT differs. Notes and limitations - Session open times are exactly what the trader configures; this program has no calendar of real exchange opens and cannot detect broker server offset automatically. - MODE_POSTPONE only ever applies to this EA's own two demo buttons in standalone mode - it cannot delay an order another program sends. - MODE_WIDEN's widened stop/target distance is a floor against MODE_STOPLEVEL plus a fixed buffer, not a measurement of how wide the market actually gapped; a very large gap can still exceed it. - It never sends, closes or modifies an order of its own unless InpStandaloneMode is on; with it off it only publishes state for other programs to use.

Expert advisor · MT4 · v1.0 · Free

About Session Open Execution Damper

Session Open Execution Damper is an expert advisor (trading robot) for MetaTrader 4. It increases the lot size after a losing trade (martingale). It has 14 settings, such as Mode, Damp window minutes and Normal slippage points. MQL source code included.

Files in the download: SessionOpenDamper.ex4, SessionOpenDamper.mq4, SessionOpenDamper.txt.

Trading robots can lose money. Check every setting and test on a demo account before using real funds.

Settings

SettingDefaultWhat it does
ModeMODE_POSTPONE
Damp window minutes15Minutes after a configured open counted as chaotic
Normal slippage points5.0Slippage used outside any damp window
Widened slippage multiplier4.0Slippage multiplier used inside a damp window (MODE_WIDEN only)
Widened stop buffer points100.0Extra distance added past MODE_STOPLEVEL inside a damp window
Standalone modefalsetrue = this EA gates and sends its own demo orders
Lots0.10
Magic number24700Magic number that tells this EA's orders apart
Stop loss pips200 = no stop
Take profit pips400 = no target
Max retries5
Retry wait ms500
Publish global variablestrue
Timer interval sec5

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
  3. Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
  4. Open the .mq4 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
  6. Test it first on a demo account or in the Strategy Tester.

Download the PDF guide

Tags: Trading Sessions · Martingale · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria