EAs working together. Could there be confusion in the price values sent or received?
-
Hi
I have an EA portfolio working on the same demo account in the same MT5 terminal. The configuration is such as
EA1 EURUSD H8 MagicNumber = 200
EA1 GBPUSD H8 MagicNumber = 210
EA1 USDCHF H8 MagicNumber = 220
EA2 AUDUSD H8 MagicNumber = 230
EA2 EURUSD H8 MagicNumber = 240
EA2 USDCAD H8 MagicNumber = 250
EA2 USDCHF H8 MagicNumber = 260
EA3 AUDUSD H8 MagicNumber = 270
EA3 EURUSD H4 MagicNumber = 280
EA3 GBPUSD H4 MagicNumber = 290
EA3 USDCAD H4 MagicNumber = 201
EA4 GBPUSD H8 MagicNumber = 211
EA4 USDCHF H4 MagicNumber = 221Each EA writes some data (OpenPrice, TPs, SL, etc.) in a Comment when the position is opened using the "Comment (ugly)" block.
The EAs open positions per their logic and set up the postion magic number as MagicNumber+Group#. Everything seems to be right. But I have noticed that the values written in the "Comment (ugly)" block does not make sense in some cases.

At the same time, there was a position opened in the AUDUSD pair:

The EAs move the SL level at the beginning of a new bar and Modify the position of the trade. But the position in the EURUSD is modified wrongly

It seems as it took the TP values from the AUDUSD pair.
That happened after this event

Something strane took place with the modify of the SL/TP when they were set to 0.0000

I am not sure if this behavior are provoked by the EAs but it happened in different broker´s demo account using the same portfolio.
Any idea on that?
Thanks
-
group number is part of magic number ... so better is explanation with example:
magic:100 + no group =>> magic:100
magic:200 + group:1 =>>> magic:201
magic:210 + group:2 =>>> magic:212
... and so on(real magic number = magic from settings + group)
https://fxdreema.com/tutorial/builder/groups-and-magic-numbers
-
Hi @miro1360
Thanks for your answer.
I know it how it works and I am pretty sure that each EA opens the postions with the right real magic number such as:
Group #11 (EA magic number on settings is 200) --> 211
Group #11 (EA magic number on settings is 201) --> 212That is fine for each EA working and for each position opened.
What I am not able to understand is why the EA attached to the EURUSD pair is taking the TP values from the EA attached to the AUDUSD pair when the position is being modified. It is very sure that both EA have different magic number set in the input parameters.
What I have found is that the EURUSD and AUDUSD positions were opened at the same time:

So I don't know why the TP level of the EA working on the EURUSD chart is modified with the values of the AUDUSD.
-
how TPi_Price calculation looks like exactly?
-
Hi @miro1360
Here you have how the TakeProfit levels are calculated:
TPi_Price = OpenPrice +/- TPi (points)
TP1 (PIPS) = 5
TP1 (Points) = TP1 (PIPS) x Point Size (5 digits -> 0.0001) = 5 x 0.0001 = 0.0005 points
OP (PRICE) = 1.00000TP1_Price (buy position) = 1.00000 + 0.0005 = 1.00050
TP1_Price (sell position) = 1.00000 - 0.0005 = 0.99950and so on.

The TP levels are placed correctly when the positions are opened even though there are other positions opened at the same time in different pairs. But, the issue takes place when the position has to be modified when a condition to move it is triggered. In this case, it seems that the TPi levels are taken from the values of other EA. Is this posible? Because it should not be possible if everything Works correctly.
-
ho are you working with this pink loop?
are you correctly selecting trade with dark pink block before? (For each trade) ...if not, here is how selection is working:
http://fxdreema.com/forum/topic/4246/example-for-each-trade -
It is not a pink block, it is a formula block where the TPi_Price variable is set.

-
Hi @miro1360
When the position is modified by the trailing stop condition, there seems to be a confusion in the TP values between different EAs.

I think this confusion in the TP prices calculation is happening when trades are opened at the same time by different EAs in the same terminal. Because initially the TPs are set correctly but incorrectly when the position has to be modified TPi calculation takes place when the positions are opened and it is not updated or recalculated.
I would like to check if this happens if I split the portfolio in many terminals but most probably will be that my VPS hangs.
Thanks
-
you need somehow understand how these "pink" things are working

... anywhere before Condition block, modify variable block or formula block must be the right trade preselected with dark ping block "For each Trade" ... -
Hi @miro1360
I really apreciate your help.
What I am not able to understand is why one EA with its own MagicNumber can take any value of other EA with a different MagicNumber. I don´t know how the workflow of sending commands to the server Works but I used to think that the commands sent by one EA is exclusively of that EA.
I have modified the "Modify Stops" block using the pink ones for the Trailing Stop Condition

But it was required to add a value in the Take Profit because with No Change option and "For each trade" I got that the TP was modified to 0.00000. There is something in the forum about it.
-
when pink block is used incorrectly, maybe it can cause issue

...this is how can you use Modify variables or Formula block with pink For each Trade selection block ...

I dont know if admin repairs this issue with null TP, maybe sometimes ..
-
Hi @miro1360
Thanks for your example.
I was looking for a way to get the Take Profit level for each opened position and you have given it to me. Because when each position is opened the TPi_Price is calculated by the sell/buy block and I can get it by using your example avoiding its calculation and reducing the project blocks number.
MANY THANKS!!!
I will update the post with the test results.
-
Hi @miro1360
As you suggested, I shifted the blue blocks by the pink ones (modify stops) to see the result of this shift. Right now I have the one EA working in 4 different pairs at the same time.
There is one trade opened (4 postions at the beginning, 1 reached its TP1) in one pair and nothing on the rest. It seems that the OrderModify by trailing stop is working correctly and the SL level are modified but not the TP that keeps the original value as happened when more than one trade was opened at the same time in by different EAs.

But I cannot be sure if that is due to
- Shift to pink blocks
- No other trades were opened at the same time
The section that seems it is not working both now and before is the conditions set in the "On trade" section

Stops levels are not modified by a closing trade detection and I don't know how to figure this out. This conditions are very necessary for the EA's behavior.
Any help Will be very appreciate.
Thanks
-
somewhere must be logic error
try to find it with simplification of EA 