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 · MT5 · v1.0 · Free
About Bar Close Confirmation Assistant
Bar Close Confirmation Assistant is an expert advisor (trading robot) for MetaTrader 5. 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.ex5, BarCloseConfirmationAssistant.mq5, BarCloseConfirmationAssistant.txt.
Trading robots can lose money. Check every setting and test on a demo account before using real funds.
Settings
| Setting | Default | What it does |
|---|---|---|
| Use risk sizing | false | Size by risk percent instead of a fixed lot |
| Risk percent | 1.0 | Percent of balance risked, used only when risk sizing is on |
| Fixed lots | 0.10 | Lot size used when risk sizing is off |
| Stop loss pips | 30 | Stop loss distance sent with the order, in pips (0 = none) |
| Take profit pips | 60 | Take profit distance sent with the order, in pips (0 = none) |
| Confirm bars | 1 | Consecutive closed bars that must confirm direction before firing |
| Require directional close | true | Require each confirming bar to close in the armed direction |
| Max drift pips | 15 | Cancel the arm if price moves this far against it before confirming |
| Arm timeout bars | 5 | Cancel an unconfirmed arm after this many closed bars |
| Magic number | 20260823 | Magic number for orders this assistant opens |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts per trade action before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
| Button color | clrSteelBlue | Button background colour |
| Text color | clrWhite | Button text colour |
| Panel x | 10 | Panel X offset, pixels from corner |
| Panel y | 20 | Panel Y offset, pixels from corner |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Experts.
- Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
- Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
- Drag the expert advisor from the Navigator onto a chart, check the settings, allow Algo/Auto Trading and press OK.
- Test it first on a demo account or in the Strategy Tester.
Tags: Buy/Sell Arrows · Risk & Lot Size · MT5 Expert Advisor · MQL5 Source Code