Loading…

Bar Close Confirmation Assistant

Click Arm Buy or Arm Sell and nothing is sent yet. The click only records the intent and the price at the moment of the click. The order is sent later, only after the bar that was forming at click time has closed, and only if that closed bar actually confirms the direction - a bullish close for an armed buy, a bearish close for an armed sell. This is a discipline tool, not a signal generator. It does not decide when to trade; it makes sure a decision already made survives one full bar of scrutiny before it becomes a position. A spike that prompted the click but reverses before the bar closes cancels the arm outright rather than firing into a move that has already failed. A configurable maximum drift also cancels the arm if price has moved too far against it even when the close technically still agrees, and an arm that goes several bars without meeting its confirmation count expires on its own so a half-finished setup never lingers on the chart. Requiring more than one confirming bar (InpConfirmBars) turns this into a stricter filter for setups that need sustained follow-through rather than a single candle. Notes and limitations - Judges direction only from the fully closed previous bar (Close[1]/ Open[1] on MQL4, iClose/iOpen at shift 1 on MQL5). Neither platform reads the forming bar, so neither can repaint or fire mid-candle. - Only one arm is tracked at a time; arming a new direction replaces whatever was already pending. - The stop and target on the confirmed order are fixed pip distances, not validated against the broker's stop/freeze level before sending - a distance too tight for the current symbol is rejected by the server and reported in the journal like any other failed order. - Trading pauses entirely, with the pending arm cancelled, whenever automated trading is not allowed (IsTradeAllowed() on MQL4; all three of TERMINAL_TRADE_ALLOWED, ACCOUNT_TRADE_ALLOWED and ACCOUNT_TRADE_EXPERT on MQL5).

Expert advisor · MT4 · v1.0 · Free

About Bar Close Confirmation Assistant

Bar Close Confirmation Assistant is an expert advisor (trading robot) for MetaTrader 4. It can size trades from your balance and risk percent. It has 17 settings, such as Use risk sizing, Risk percent and Fixed lots. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
Use risk sizingfalseSize by risk percent instead of a fixed lot
Risk percent1.0Percent of balance risked, used only when risk sizing is on
Fixed lots0.10Lot size used when risk sizing is off
Stop loss pips30Stop loss distance sent with the order, in pips (0 = none)
Take profit pips60Take profit distance sent with the order, in pips (0 = none)
Confirm bars1Consecutive closed bars that must confirm direction before firing
Require directional closetrueRequire each confirming bar to close in the armed direction
Max drift pips15Cancel the arm if price moves this far against it before confirming
Arm timeout bars5Cancel an unconfirmed arm after this many closed bars
Magic number20260823Magic number for orders this assistant opens
Slippage pips3Slippage tolerance, in pips
Max retries5Attempts per trade action before giving up
Retry wait ms500Pause between attempts, milliseconds
Button colorclrSteelBlueButton background colour
Text colorclrWhiteButton text colour
Panel x10Panel X offset, pixels from corner
Panel y20Panel Y offset, pixels from corner

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: Buy/Sell Arrows · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria