Excellent! Indeed, that was the problem. Thank you very much for your help @RGoo !
Latest posts made by mlumbreras
-
RE: Issue with Foreach Tradeposted in Questions & Answers
-
RE: Issue with Foreach Tradeposted in Questions & Answers
Thank you very much for your reply @RGoo . I wanted to make it too complicated. Your example is more in line with what I want, but I still have a problem.
Continuing with your example, blocks 139 and 141 should open a pending order with double the volume for each of the open trades. Currently, the pending orders are created, but one of them is closed and I don't know why.

-
Issue with Foreach Tradeposted in Questions & Answers
I have created an EA that according to the configuration creates up to 5 pending buy orders (all at the same point) and 5 pending sell orders (all at the same point). This is configured in the "On tick" section and works correctly.
In the "On trade" section, I want to configure that every time a pending trade enters the market, the pending orders of the opposite type are closed and if the option to make a second trade is activated, a second trade of the opposite type must be opened.
For example: Initially a buy stop and a sell stop are placed simultaneously. The buy I am enters the market, a buy order is generated, at which point the initial sell stop is removed and another sell stop is opened for double the volume.
I have tried several ways, but it does not remove the pending orders after opening the first trade or trades, does anyone know how I can do this?
This is my project: https://fxdreema.com/shared/nJTEUPsbb
P.S. In case anyone is wondering, I want to do this so that I can spread the total volume over several trades.
Thank you in advance for your help.