Source code
Prevent duplicate EA orders without blocking valid signals
A fast stream of events can evaluate the same entry condition more than once before the account state visibly changes. Checking only the current position count may not cover a request that is still in progress.
Define one signal identity
Use a meaningful identifier such as strategy, symbol and signal-bar time. Decide whether one entry per bar, one entry per direction or multiple entries are intended. The definition belongs to the strategy.
Track request state
Keep a clear distinction between eligible, submitted, confirmed and rejected. Reconcile state with trade transactions and broker-held orders. A rejected request should not remain permanently marked as a successful trade.
Test interruptions
Exercise a rapid tick sequence, delayed execution and a terminal restart. Confirm that recovery neither repeats a completed action nor blocks the next legitimate signal. Keep transaction handling lightweight.
Customise the behaviour
MQLume source projects make the entry lifecycle inspectable. This is a practical place to improve logging and control rather than merely adding a long sleep, which can hide the race without solving it.
Start with a free editable EA project · Explore MQLume source code
Back to top