Advertisement IC Markets

Magic numbers and the multi-order mess in automated scalping

Share, develop, and backtest custom MQL4/MQL5 Expert Advisors, Python data-scraping scripts, trading bots, and automated market alert systems.
Post Reply
Amanhasnoname
Posts: 1506
Joined: Fri Oct 30, 2026 9:45 am

Magic numbers and the multi-order mess in automated scalping

Post by Amanhasnoname »

Automated strategies tag their orders with an identifier so that each knows which ones belong to it. When several systems run on one account, mistakes in that tagging cause real damage.

Common problems include two strategies using the same magic number, one closing the other's trades, and orders opened manually being modified by a script. Hedging accounts add complexity, since multiple tickets can exist on one symbol at the same time.

Symptoms are puzzling. Trades close for no apparent reason, stops get moved, and positions open twice.

Simple discipline avoids most of it. Give every system a unique identifier, document it, and keep manual trading on a separate account or at least clearly flagged.

Logging every order action with its identifier gives an audit trail for tracing odd behaviour.

When moving to a netting account, the whole logic changes, since positions merge into one per symbol. Strategies written for hedging need rework.

How do you separate multiple systems or manual trades on the same account?
Recommended broker for automated trading & scalping IC Markets
Post Reply