The strategy number is in the "strategyIndex" variable.
Please note that the first strategy has an index 0.
The easiest way to have Magic Number equal to the strategy number is to change the formula to:
int GetMagicNumber(int strategyIndex)
return strategyIndex + 1;
It will make the first strategy with magic number 1, the second with magic number 2, and so on.
Be careful to not override the magic number of one portfolio with another when they run on the same symbol.
The Portfolio Expert distinguishes the positions by symbols, so you can have the same magic number in different charts.