Skip to main content
Version: 2.0

MAG - Magic Number

Parameters for the magic number

A magic number is a unique identifier that groups all trades initiated by a specific application. In the context of MetaTrader, this is utilized to prevent interference between different applications. For instance, if applications A and B use 123456 and 654321 as their magic numbers, each trade these applications open will be marked with these numbers. Ideally, each application should only modify trades configured with its magic number. The Meta Extender strictly adheres to this rule. While every application compatible with MetaTrader should follow this rule, some do not. For this discussion, we'll assume that any third-party application you use does adhere to this rule.

Input variable within MetaTrader
(Identifier in SET file)
Default valueComment
> (MAG) Avoided range start
(IN_nMagAvoidedRangeStart)
100000The input value cannot be smaller than 0.
> (MAG) Avoided range end
(IN_nMagAvoidedRangeEnd)
200000The input value cannot be smaller than 0.

Many third-party applications allow you to specify which magic number should be used. However, the Meta Extender operates on a different principle. Its input parameters > (MAG) Avoided range start and > (MAG) Avoided range end define a range within which a magic number should not be searched and used. Your Meta Extender will automatically search for an available magic number in the remaining number range. All FEA Trading applications follow this principle. To ensure the applications do not use the same magic numbers, a mechanism is in place to prevent a magic number from being used twice.

Used magic numbers for application.png

The above illustration explains this principle using a number line. Assuming > (MAG) Avoided range start is set to 100.00, and > (MAG) Avoided range end is set to 200.000, the actual randomly selected magic number can be any value between 0 - 99.999 and above 200.000. All applications use 100.000 and 200.000 as default values, so it is recommended to configure any other third-party application with a dedicated magic number between 100.000 and 200.000.