Loading…

Price Alert To Order Bridge

A price alert on its own only tells a trader something happened - they still have to be at the screen to act on it. This EA closes that gap for trades where the decision was already made in advance: set the trigger price, the direction it must be reached from, and what should happen when it fires - buy, sell, or alert only with no trade at all. The trigger is deliberately one-shot. It fires the first time its condition is true and disarms itself immediately, even if the resulting order attempt fails after exhausting its retries. A price alert that keeps re-checking and re-firing every tick once past its level would be far more dangerous here than one that gives up quietly and needs the EA restarted to re-arm - repeated automatic order attempts on every tick past a level is not a failure mode this EA is willing to have. Stop loss, take profit and position sizing follow the same conventions as the rest of this catalogue: pip distances converted per-symbol from the broker's digit count, and risk-based sizing built from MODE_TICKVALUE and MODE_TICKSIZE rather than a hardcoded contract size. Notes and limitations - Fires once per attachment. Reattach the EA, or change an input to rerun OnInit, to re-arm it at the same or a new level. - Uses the bid price to evaluate the trigger regardless of trade direction, matching how a price alert is normally read on a chart; the fill price for a resulting order still uses the ask or bid as appropriate for the order side. - No gap or spike filtering - a single fast tick that satisfies the condition fires immediately, the same as a manual price alert would. - If InpResponse is alert-only and both notification channels are off, the EA refuses to initialise, since it would then do nothing at all. - On a netting account, a triggered order can merge into a pre-existing position on the same symbol rather than opening separately - see MQL4 VERSUS MQL5 DIFFERENCES above.

Expert advisor · MT4 · v1.0 · Free

About Price Alert To Order Bridge

Price Alert To Order Bridge is an expert advisor (trading robot) for MetaTrader 4. It can size trades from your balance and risk percent. It has 14 settings, such as Trigger price, Trigger direction and Response. MQL source code included.

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

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

Settings

SettingDefaultWhat it does
Trigger price0.0Price level that arms the bridge
Trigger directionTRIGGER_ON_RISEWhich side the level must be approached from
ResponseRESPONSE_ALERT_ONLYWhat happens once triggered
Popup alerttrueShow a terminal popup alert on trigger
Push notificationfalseSend a push notification on trigger (requires MetaQuotes ID set)
Stop loss pips50Stop loss distance from the fill price, in pips (0 = none)
Take profit pips100Take profit distance, in pips (0 = none)
Use risk sizingfalseSize by percent risk instead of a fixed lot
Risk percent1.0Percent of equity risked, when risk sizing is on
Fixed lots0.10Lot size when risk sizing is off, or as a fallback
Magic number20260218Magic number for the order this EA places
Slippage pips3Slippage tolerance, in pips
Max retries5Attempts before giving up
Retry wait ms500Pause between attempts, milliseconds

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

Expert advisors (EA) for MT4 & MT5 · PolyMaria