Empty Group #
-
What happen if I left all the blocks with empty Group# and I have 2 EAs with different magic number in the same instrument? Will interact each other? In this case shall I set 0 (or other) to don´t?
-
2 magic numbers. The EAs will not interact, except when you deal with the option for all order
-
Thank you for the answer sktsec, because I have 2 EAs magic numbers 9 and 6061, one have the block in loop for "each position" some condition an then buy at market and copy the SL and TP for the trade in loop, but the EA is trying to copy the SL and TP from the other EA.

-
I have do a simple demo test in MT4. Pretty sure the Loop Block would not read those open trades with another magic numbers.
I run 2 EAs which each open a trade and then loop to see it. Then I closed one of them. Confirmed the one without trade cannot see the other's trade.
May be some bug in your case, provide you sure the trade is made by another EA. Any chance you misread the trade that is actually made by the same EA ?
-
Nop, was trying to copy the stop loss from the other EA with the other magic number 100%, is MT5, and I readed somewhere that the block "For each position" could interact with other EAs if you don´t put at least Group# 0, but don´t know if it´s true,, should be true as my issue,, now I´m modifying the EA with Group 0 to check if happen again
-
@Boillot84
I check the code for MT5.
if (group == "")
{
if (magic_number == MagicStart)
{
group_pass = true;
}
}
But
bool TradeSelectByIndex(
int index,
string group_mode = "all",
string group = "0",
string market_mode = "all",
string market = "",
string BuysOrSells = "both"
)An attempted to fix the bug would be
replace all -> group = "0"
with -> group = "" -
Wow, TY, I don`t really understand, is this mean that will be fixed with Group=0?
-
First open the downloaded source file and open it.
As you can see, the variable "group" is of string type, and it is likely to take up the value of "" as default value.
But instead it takes a value of "0", and thus magic number is not used according to the logic that "" should be used instead.
That means a quick fix try would be replace that "0" with ""
First find TradeSelectByIndex, then if you see group = "0", replace it with "".
Or more directly, use the editor to replace ALL "0" with "".
Noted that "0" is unusual because its type is string rather than number.
That's what I could probably guess, please try and see it can help
-
Oh, cool ty very much sktsec, I will, another idea is to use group 1 or 2 or so on for all the blocks in the EA, I´lllet you know