Loading…

Limit Order Chaser

A limit order placed a fixed distance from the market and left alone either fills eventually or never fills at all, and "never" is the outcome that costs a missed trade. This EA rests a limit order at a chosen offset and, as the market moves, repositions it to keep chasing that same offset - but only within a capped band measured from where the plan originally started, and only until a deadline. Past either limit, it stops chasing and, once the deadline is reached, cancels the resting order and sends a market order instead so the position is guaranteed to be entered one way or another. Repricing uses OrderModify on the existing ticket rather than deleting and recreating the order: it is one broker round trip instead of two, and it never leaves a moment with no resting order at all, which a delete-then-recreate sequence briefly does. The chase distance is measured from the original reference price at placement, not from the last reprice, so a slow grind in one direction cannot walk the order arbitrarily far from where it was actually meant to sit - once the band is exhausted the EA simply waits for the deadline rather than following the market indefinitely. Notes and limitations - One order per run. The EA places a single pending order, manages it to either a fill or a deadline conversion, and then stops - it does not repeat automatically. - If the terminal or EA stops running while an order is still resting, that order is left on the broker exactly as it is - it is no longer chased or converted at the deadline once the EA is not running to do it. - The deadline's guaranteed market order can still fail after every retry (for example if AutoTrading is off or the connection is down); the EA logs this loudly rather than assuming it succeeded. - Repricing checks the broker's minimum stop and freeze distance before every move and skips a cycle rather than sending a price that would be rejected.

Expert advisor · MT5 · v1.0 · Free

About Limit Order Chaser

Limit Order Chaser is an expert advisor (trading robot) for MetaTrader 5. It places pending buy/sell stop or limit orders and has a news filter. It has 13 settings, such as Direction, Lots and Entry offset pips. MQL source code included.

Files in the download: LimitOrderChaser.ex5, LimitOrderChaser.mq5, LimitOrderChaser.txt.

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

Settings

SettingDefaultWhat it does
DirectionCHASER_BUYDirection to enter
Lots0.10Order size
Entry offset pips10Distance from market for the resting limit, in pips
Reprice threshold pips5Market movement required since the last reprice before moving again
Max chase pips40Maximum drift from the original reference price - beyond this it waits, does not chase further
Deadline minutes30Convert to a market order if still unfilled after this long
Stop loss pips0Stop loss attached on placement, pips (0 = none)
Take profit pips0Take profit attached on placement, pips (0 = none)
Start tradingfalseMust be true for the EA to actually place or modify orders
Magic number20261206Magic number identifying this order
Slippage pips3Slippage tolerance, in pips (used only for the deadline market order)
Max retries5Attempts per action 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 5 open File → Open Data Folder, then go to MQL5 → Experts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 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: Pending Orders · News Trading · MT5 Expert Advisor · MQL5 Source Code

Expert advisors (EA) for MT4 & MT5 · PolyMaria