Loading…

Conditional Order Builder Panel

MT4's native pending orders only ever act on the same symbol they are placed on, and can only trigger on that symbol's own price touching a level. There is no built-in way to say "if EURUSD breaks 1.1000, buy GBPUSD" - trading a level break on one instrument with an order on a different one. This panel builds that missing conditional order type out of chart objects and a per-tick monitor. Each of the four rule rows is fully interactive: an edit box for the watch symbol, a button toggling whether the trigger is a cross ABOVE or BELOW the level, an edit box for the level itself, an edit box for the action symbol, a button toggling the action side (BUY/SELL), an edit box for the action lot size, and an ARM/DISARM button. Watch and action symbol can be the same instrument or different ones. Triggering requires a genuine cross, not just "price is currently past the level" - the panel remembers the watch symbol's price from the previous tick and only fires when that previous reading was on one side of the level and the current reading is on the other. Without this, a rule armed after price had already passed the level would fire immediately, which is not what "if it crosses" means. Each rule is single-shot: it disarms itself the instant it fires, so a fast or choppy market cannot trigger the same rule repeatedly - re-arm it by hand if you want to watch for another cross. Notes and limitations - Fixed at four rules. Each is single-shot - it does not re-arm itself after firing. - Fired actions are plain market orders with no stop or target attached. - The "previous price" used to detect a cross is only established once a rule is armed; arming a rule re-baselines it, so the earliest possible trigger is the tick after arming, never the arming tick itself. - Level checks run on Bid price only. A symbol crossing on the Ask side (relevant mainly to spread-sensitive setups) is not distinguished. - Rule state (armed/disarmed, previous price) lives only in the running EA instance - a terminal restart clears every rule back to disarmed and the fields must be re-entered or re-armed. - No duplicate-fire protection across rules - two rules with the same action symbol can both open positions independently if both trigger.

Expert advisor · MT4 · v1.0 · Free

About Conditional Order Builder Panel

Conditional Order Builder Panel is an expert advisor (trading robot) for MetaTrader 4. It has 8 settings, such as Default lots, Magic number and Slippage pips. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
Default lots0.10Lot size preloaded into each rule's action leg
Magic number20260392Magic number for orders opened by this panel
Slippage pips3Slippage tolerance, in pips
Max retries5Attempts per action before giving up
Retry wait ms500Pause between attempts, milliseconds
Corner1Panel corner: 0=top-left 1=top-right 2=bottom-left 3=bottom-right
X offset12Panel offset from the chosen corner, X pixels
Y offset18Panel offset from the chosen corner, Y pixels

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: EURUSD · GBPUSD · Pending Orders · MT4 Expert Advisor · MQL4 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria