Candle Close Stop Guard
- Utilitários
-
AL MOOSAWI ABDULLAH JAFFER BAQER
To trade successfully we need to go through the proven path that others had gone and reached!
Here are 17 quotes from such successful investors:
1- Limit your size in any position so that fear does not become the prevailing instinct guiding your judgment.
Joe Vidich - Versão: 1.0
- Ativações: 5
STOPS ONE WICK OR SPREAD SPIKE FROM KNOCKING YOUR TRADE OUT: YOUR STOP LOSS FIRES ONLY WHEN A CANDLE CLOSES BEYOND IT.
Before: a buy on EURUSD with the stop 25 pips below. At 23:59 the rollover spread widens, one wick dips 3 pips through the stop, the trade closes for a full loss, and the H1 candle closes 10 pips above your level. After: the same wick touches the level, the candle closes back inside, the trade stays open, and the panel counts one WICK SAVED. A wider emergency stop (300 points beyond the level by default) sat on the broker's server the whole time.
Built for traders whose stops are right but get taken by noise, by hand or with an Expert Advisor or copier. One promise: a stop decided by the close of the candle you trade, never by a single tick. Mechanism: your own stop becomes the candle-close level, the broker stop moves out to an emergency distance, and the position is closed at market when a candle of your timeframe closes beyond the level.
Fits your account: hedging and netting accounts, works beside any EA or trade copier on the same terminal (symbol and magic filters decide what it touches), and keeps a real stop on the server at all times, which matters on prop-firm accounts that require a stop on every position. It never opens a trade on a live account.
Try it free first: run Candle Close Stop Guard in the Strategy Tester with visual mode on. There it opens small demo positions with a stop one ATR away, so you can watch the emergency stops appear, the wicks that touch the level without closing the trade, and the positions closed when a candle really closes beyond it.
Who this is NOT for: scalpers whose risk must be capped at the exact stop price on every tick (the emergency distance is extra risk you accept for fewer false stops), and anyone who will not keep the terminal running; the candle-close check only works while the guard runs, the emergency stop is what protects you when it does not.
In short
- Your stop loss becomes a close-confirmed level: the position closes only when a candle of the chosen timeframe (H1 by default) closes beyond it, optionally by a buffer.
- Emergency stop on the server, a set number of points beyond the level, so a crash or a disconnect never leaves the position without a stop.
- You keep control: move your stop in the terminal and the guard takes the new price as the new level; remove it and the guard leaves that position alone.
- Positions without a stop can get a level a set distance from the open (off by default).
- WICKS SAVED counter, IF CLOSED NOW preview, PRESSURE bar per position and dashed level and emergency lines on the chart.
- RESTORE STOPS button and automatic restore on removal: every emergency stop goes back to its level.
- Not a grid, no martingale, no averaging, no DLLs, no web requests, no extra files.
START HERE
Attach it to one chart, for example EURUSD H1. One copy guards every symbol of the account unless you limit it. Keep the defaults (H1 candle close, no buffer, emergency stop 300 points beyond the level, restore on removal). Put your usual stops on your trades, turn on Algo Trading, and watch the panel: each stop shows GUARDED once its emergency stop is on the server. If you want to watch first, use mode 0: the broker stop then stays on your level and the guard only reports.
Why normal stops lose trades that were right
A stop loss on the server reacts to one price, the first tick that touches it. That tick can be a news spike, a rollover spread that widens for two minutes, a thin market at the Asian open or a stop run around an obvious level. The candle then closes back where you expected, without you. Many traders handle this by watching the chart and closing by hand only when the candle closes beyond their level. This guard does exactly that, on every position in scope, every candle, while keeping a real stop further out as insurance.
The life of one guarded position
Adopt. The first time a position with a stop is seen, its stop price becomes the level. In mode 1 the broker stop is moved to the emergency distance beyond the level; the panel shows the level and the emergency distance in points, and the chart shows both lines for chart-symbol positions.
Watch. On every closed candle of your timeframe the guard compares the close with the level. A low (for a buy) or high (for a sell) that reached the level while the candle closed back inside is a wick saved: you get one message and the counter goes up. While the forming candle is beyond the level the state reads BEYOND - WAIT CLOSE and IF CLOSED NOW tells you how many positions would close.
Close. When a candle closes beyond the level (plus your buffer), the position is closed at market with the comment CCG close confirmed. If the market runs straight to the emergency stop inside one candle, the broker's emergency stop closes it.
Hand back. Press RESTORE STOPS, or remove the guard from the chart, and every emergency stop still in place goes back to its level. If the price is already too near or past the level, the emergency stop stays and you get one message.
Safety patterns inside
Before any send it checks that Algo Trading is allowed, that the symbol is tradable, that its trade session is open and that the last quote is no older than 5 minutes. A refused send is retried with a growing pause up to 2 minutes, with one alert after a set number of failures. If the broker refuses the filling mode, the next allowed one is tried at once. Right before each send the position is selected again and its symbol, magic and stop are checked again; a stop you changed in the meantime is never overwritten. Every stop respects the broker's stops and freeze levels. Per-position memory (level, emergency stop, last checked candle) is kept in GlobalVariables whose keys contain the chart symbol and the magic filter, so a terminal restart does not lose a level and two copies on different charts never share a key.
Inputs, every one explained
CANDLE CLOSE
InpTF = H1. The timeframe whose candle close decides. Current means the chart timeframe.
InpBufferPoints = 0. The close must pass the level by at least this many points.
InpDefaultPoints = 0. Positions without a stop get a level this many points from the open price (from the current price if the open-based level is already passed). 0 leaves them alone and lists them as NO SL.
EMERGENCY STOP
InpMode = 1. 0 alert only: the broker stop stays on your level and the guard reports. 1 close on candle close with an emergency stop on the server.
InpEmergencyPoints = 300. Distance of the emergency stop beyond the level, in points. Use more on gold and indices.
InpRestoreOnRemove = true. Put every emergency stop back on its level when the guard is removed from the chart.
EXECUTION
InpSlippagePoints = 30. Maximum slippage on a close. InpFailAlertAt = 3. One alert after this many failed attempts on one position.
FILTER - WHICH POSITIONS ARE GUARDED
InpSymbolScope = All symbols, or the chart symbol only. InpMagicFilter = Any magic, only manual trades (magic 0), or only the magic number InpMagic.
ALERTS
InpAlertPopup = true. Pop-up alert. InpAlertPush = false. Push notification to the MetaTrader app on your phone (enable it in the terminal options).
PANEL
ShowPanel = true. ShowLines = true: dashed level line and dotted emergency line for chart-symbol positions. PanelX = 12, PanelY = 15: offset from the top left corner; the MOVE button drags it. PanelFontSize = 9. MaxTableRows = 6, MaxHistoryRows = 4. On a short chart the panel drops its least important rows first.
STRATEGY TESTER DEMO
InpTesterDemo = true. In the Strategy Tester only: Monday to Friday 08 to 16 one demo position per 4-hour slot on the chart symbol with a stop one ATR(14) away, at most 3 open, margin checked times 1.5 before every order, closed after 3 days, stopped after a 20 percent balance loss. This code never runs on a live or demo chart.
The panel
NEXT CANDLE CLOSE: a bar that fills while the current candle of your timeframe runs, with the time left. STOP PLAN: the confirming candle and buffer, the mode, IF CLOSED NOW, wicks saved, positions closed on a close, guarded levels, positions without a stop, last action, Algo Trading on or off, the removal setting, failed sends, totals and positions in scope. POSITIONS, CLOSEST TO THE LEVEL FIRST: symbol, side, lots, distance to the level and to the emergency stop in points, profit, state and a PRESSURE bar that fills as the price nears the level. States include GUARDED, WATCHING, SET EMERGENCY, BEYOND - WAIT CLOSE, CLOSING, WICK SAVED, NO SL, STOP REMOVED, EMERG N/A, MARKET SHUT and RETRY. ACTION HISTORY keeps every emergency stop, wick, close and restore with server time. QUICK CONTROLS: ARMED or PAUSED, the mode button, and RESTORE STOPS, which pauses the guard and puts every stop back on its level. The right side of the chart stays clear.
What it cannot do
It does not make a losing trade a winner. Closing on the candle close can be worse than the original stop when the candle closes far beyond the level; the buffer and the emergency distance are your limits for that. It only works while it runs: with the terminal off or Algo Trading off, the emergency stop is your stop. Keep the terminal running, for example on a VPS. History and totals reset on restart; the per-position memory does not.
What was and was not tested
Tested in the Strategy Tester on a hedging account, 1 to 30 June 2026, 1-minute OHLC, deposit 10000, leverage 100, five runs, with no journal error and no failed send. EURUSD H1 defaults: 40 demo positions, 40 emergency stops set, 42 wicks saved, 27 positions closed on an H1 close beyond the level. EURUSD with H4 candles, a 50 point buffer and a 1500 point emergency stop: 33 positions, 29 wicks saved, 19 closes. XAUUSD with H4 candles: 34 positions, 12 wicks saved, 4 closes. Mode 0 on EURUSD: nothing changed on 42 positions. A run with a default level of 200 points also ran clean. On a live demo chart the panel ran in alert-only mode beside 4 open EURUSD positions without stops and changed nothing.
Not tested at the time of writing: real sends on a live or demo broker, a netting account, retries after a broker refusal, a filling mode refusal, a stop moved or removed by hand while guarded, RESTORE STOPS and the restore on removal, chart symbol scope, magic filters, pop-up and push alerts, and a terminal restart. These paths exist in the code and are described by design. Please try them on a demo account with your own broker first.
Try it in the Strategy Tester
Choose Candle Close Stop Guard, EURUSD or XAUUSD, H1, any recent month, visual mode, and press Start. Watch the dotted emergency lines appear under each stop, and count the wicks that touch the dashed level while the trade stays open.
If the guard kept you in a trade a wick would have taken, or you think it should handle a case differently, an honest review on the product page helps other traders decide and tells me what to improve next.
