Is it possible to set core Magic number from variable ?
-
Hi,
I already assign different magic numbers to each trade, which as I understand it are a suffix to the core magic number defined in:-
Project Options / Genertal Properties / Magic Number
I would be interested to know if it is possible to change the core Magic Number (Project Options / Genertal Properties / Magic Number) from a user entered external variable input when the EA starts.
This would be useful for running multiple versions of the same EA on the same pair.
Many thanks.
-
There is already one input parameter called MagicStart that sets the magic number. This parameter is automatically created for all EAs. The name "MagicStart" is a litthe bit stupid, it means that this is the magic number and "start" means that you start with this number and if in the EA you are using Group numbers bigger than 0, the actual magic numbers of the trades will be bigger that MagicStart.
-
I couldn't find availability of that input parameter in any of the block so I created a simple code block: [MagicStart = My_Magic_Start;]
Works great, thank you.
-
There is no block to change this value, because the value is an input parameter and in my opinion it is not supposed to be modified in the EA. Actually if you try this trick in MQL5 you will get an error message.
In the EA, in all trading blocks you can find this Group parameter. If you want to somehow have 2 or more strategies in the same EA, you can try do it with this parameter.