Set your own MQL trade numbers

There are times when you may want to track a trade through various events. The obvious example is finding the remaining trade after a partial close but you may also need to track a pending order through to the position after execution.

A simple option for this is to use a custom magic number for each trade by concatenating a base magic number with a sequential trade number. It’s a simple idea but there are a few things to consider.

This video shows a number of functions that will help with using a compound magic number. I also have an earlier video here with a different technique for tracking orders through a partial close.

Download the code from

Leave a Comment

Scroll to Top