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
| Setting | Default | What it does |
|---|---|---|
| Trigger price | 0.0 | Price level that arms the bridge |
| Trigger direction | TRIGGER_ON_RISE | Which side the level must be approached from |
| Response | RESPONSE_ALERT_ONLY | What happens once triggered |
| Popup alert | true | Show a terminal popup alert on trigger |
| Push notification | false | Send a push notification on trigger (requires MetaQuotes ID set) |
| Stop loss pips | 50 | Stop loss distance from the fill price, in pips (0 = none) |
| Take profit pips | 100 | Take profit distance, in pips (0 = none) |
| Use risk sizing | false | Size by percent risk instead of a fixed lot |
| Risk percent | 1.0 | Percent of equity risked, when risk sizing is on |
| Fixed lots | 0.10 | Lot size when risk sizing is off, or as a fallback |
| Magic number | 20260218 | Magic number for the order this EA places |
| Slippage pips | 3 | Slippage tolerance, in pips |
| Max retries | 5 | Attempts before giving up |
| Retry wait ms | 500 | Pause between attempts, milliseconds |
How to install
- Download the ZIP from your PolyMaria library and unzip it.
- In MetaTrader 4 open File → Open Data Folder, then go to MQL4 → Experts.
- Copy the .mq4 file(s) there. Put any .mqh files in MQL4 → Include.
- Open the .mq4 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: Alerts · Risk & Lot Size · MT4 Expert Advisor · MQL4 Source Code