MagicStart + Random?
-
Hello,
I am curious if there is a way to set the Magic Number for EA's to something thats related to Symbol and maybe Timeframe.
Why: I wrote an EA and I am still working on deatails. I have it on several Charts / Symbols / Timeframes. Everytime I put the EA on a new chart or recompile the EA I have to stop trading and set the Magic Number manually for not having conflicts
Solution would be to do something like that: MagicStart + NumericRespresentation of Symbol (maybe the AsciiValues or is there a SymbolEnum) + TimeFrameEnum = individual unique Magic Number

-
At the moment I don't use such function. I remember that someone advised me to do it like this before, but I wasn't convinced do make it fact. Well, if you have such function you can use it. Custom function can be defined in https://fxdreema.com/studio and then used directly from every block. Don't try to modify MagicStart, if you do something, better do it with the Group number.
But if you add the same EA in two different symbols with the same magic numbers, this is not a problem because the default setting in all blocks like "No trade" are to work with the current symbol only.
You know what... I think it will be enough to use Group number as something like _Period. This is predefined integer variable in MetaTrader and is something like the function Period(). This will separate trades when the same EA is used in different timeframes. As I mentioned above, by default there is symbol (market) separation.
-
__But if you add the same EA in two different symbols with the same magic numbers, this is not a problem because the default setting in all blocks like "No trade" are to work with the current symbol only./quote]
Interesting. I did not know that. I was changing the magic number for each chart.
I am also planning to create a multicurrency putting EA in one chart, and I'm searching here in the forum a way to do this that does not give conflict between currencys.
So in this case if you open a position in EURUSD (using the block No position, for example), and give a signal on GBPUSD, this new position will not be opened because it is still open a position on EURUSD, that, even though in other currency?
-
For MT5 as you know, 1 position per symbol is allowed. I guess that it's not possible to have 2 separate EAs under the same symbol. At least until now, I am talking for those classic positions. So for MT5 magic number does not really matter when it comes for positions
-
__For MT5 as you know, 1 position per symbol is allowed. I guess that it's not possible to have 2 separate EAs under the same symbol. At least until now, I am talking for those classic positions. So for MT5 magic number does not really matter when it comes for positions[/quote:1r7k83sd]
Yes yes ... perfectly. I wonder if adding EA in one currency chart , but operate in different currencies at the same time with a magic number for each currency. -
Absolutely. But what is the point of the magic number in this case, the symbol name is enough to separate positions. Only in MT4-like environment you need magic number to separate trades from the same symbol and type.
-
Ah ... interesting ... so it is more practical to operate with several currency pairs at the same time through the MT5?
Just by using the Set "Current Market" Block for next blocks?
-
EDIT: sorry, I wrote something here in the wrong topic
Well, yes, this block can do what it is supposed to do, I guess