How to get the magic number for a closed trade

Will magic number disappear if an order is closed?

Magic number is used for trade identification and is set when a trade is opened. . For instance, if you have two EAs that are placing trades, to alter the trades or close them, each should be able to identify which opened positions belong to it. When an order is closed, its magic number does not disappear but will most likely have some extra characters appended to it by your broker.