#What is Magic Number?

In MetaTrader the term Magic Number is just a property of each trade and pending order. The magic number is 0 by default, but it can be set to any numeric value by your Expert Advisors. The idea is that every Expert Advisor can recognize its own trades and orders only by looking at their Magic Numbers. This is sometimes necessary, because you could have 2 or more Expert Advisors making trades with the same Symbol name, and you don't want one Expert Advisor to mess with the trades from another.

For example, you can have Expert Advisor A who creates EURUSD trades with Magic Number 123 and another Expert Advisor B who creates EURUSD trades with Magic Number 456. When you look at the list of trades in MetaTrader you will not be able to recognize which trade is created by which Expert Advisor, because magic numbers are not listed, but Expert Advisors can and they should do it.

Sometimes you don't need to care what the magic number is. If Expert Advisor A is working on EURUSD and Expert Advisor B is put on GBPUSD, then the Symbol name itself is enough to separate the trades. Both Expert Advisors will work fine and not mess with each other.

#Group Numbers In fxDreema?

We already know that we can use multiple Expert Advisors to work with different trading strategies under the same MetaTrader. But we can also apply different strategies inside the same Expert Advisor, because it can operate with trades with different Magic Numbers. There is no requirement for our Expert Advisor to use only one Magic Number, it can use many.

So, the Group number is just an extension of the Magic Number. Each Expert Advisor created with fxDreema has one input parameter called MagicStart, which is the base magic number for all trades. The Group number is by default 0 (empty value) everywhere, so each trade/order would have Magic Number that is equal to the MagicStart input parameter.

This is the relationship between all these numbers:

Magic Number = MagicStart + Group

Now, let's imagine that we have MagicStart set as 1000. Then...

  • If Group is 0, then the Magic Number will be 1000
  • If Group is 1, then the Magic Number will be 1001
  • If Group is 2, then the Magic Number will be 1002
  • ... and so on

If you don't really need to use different Group numbers in your project, don't change it in the blocks. Because if you set it to let's say 1 in the Buy now block, then you must set it to the same value in all of the other blocks involved with the trades made by that Buy now.