Trouble with "Trade closed" block
-
Hello. I ve made a working EA but I am having trouble with "Trade closed" block. It works well with Buy positions, but doesn't work at all with Sell.
I need it to close all positions if Sell position reaches SL. And another block for opening new position if TP is hit. It just doesn't do it. I hope somebody can help me figure it out.

-
@andreks Hi, for me works
-
@ambrogio
Yes. Exactly my problem. It works with buy positions. Once buy is closed it opens sell. But it doesn't work vice versa. If sell position is closed via TP it doesn't open new buy position.
Or if sell position is closed with SL it doesnt close all positions. -
^How does your close trades section look like? Maybe you just copied it and don't specify the Filter by Type setting?
Furthermore I'd work woth a For each Trade block before the Close trade block. -
This is how it looks like
https://fxdreema.com/shared/oJCHzAi1c
I think there is nothing wrong with logic. But for some reason right side of blocks doesn't behave the same as left side.@trader-philipps I ve tried "For each trade" block but for some reason it doesn't do nothing remotely close to what I am expecting from it.
-
Try filtering by type on blocks 4 and 8. Now both close buys and sells at the same time. Just limit the to buys OR sells only.
-
@l-andorrà I tried it already. It closes all sells if buy SL is reached. But if sell SL is reached it only closes the most recent buy position and for some reason triggers my "No trade" block on tick and EA opens new positions even though the previous wasn't closed completely and are still running.
-
Thank you everyone for assistance. I solved the problem. I tested both sell and buy completely separate and it was doing exactly what I want it to do. And to get them work together, I just needed the turn the sell blocks off if buy was triggered and vice versa.
This is how it looks like -
Congratulations!
Just curious. Why are you turning ON/OFF different blocks when considering buys and sells? I think they should be exactly the opposite of the other. -
@l-andorrà
Because the EA sometimes is running trades both directions and if SELL trade was closed with SL it had to close all trades at the same time. But instead it closed only the most recent BUY trade which was in profit and opened new sell trade. In my opinion EA thought that "BUY close with TP" was trigered because buy trade was in profit and it executed blocks accordingly. -
Ok. Thanks for the clarification. Once again, good job!

-
how do I use indicators to exit the market because my strategy has dynamic take profits and stop loss