Grid strategy - How can I close last trade created with the first created?
-
Hello,
I am trying to create a grid EA. I managed to close a batch of trades all together when thy reach an average profit. So if I have 10 trades, they will get all closed in case the price goes in my favour.
However I need that at each cycle of trades, the last trade created closes with the first created. No matter how trades I have. Once they close, the second trade created closes with the actual last created, once their average reaches a profit. I am attaching an image (there is an EA which I am trying to replicate).
How can I do that?
Thank you!
-
@lllll You can select that here:

-
@l-andorrà said in Grid strategy - How can I close last trade created with the first created?:
Thank you for your answer, however I dunno know how to implement this block. I tried to used it but everytime I use it, it opens and closes trades uncontrollably, I don`t know what is going on...
-
@lllll This block is a loop. This means it will automatically search for all open trades right now. By selecting any of those options you can identify the oldest open trade and the newest open trade as you required.
-
can you example. Thanks in advance. and I am trying to achieve this but without success.
-
@radion Try this to close the oldest and the newest open trades:

-
Thank you. I will try now.
-
Whenever I use "For each trade" block, as soon as it trigger the condition to open the second trade, it opens way too many. Doen`t matter the option I set. Blocks are: No trade, buy; add to vol every x pips. Without each trade it works, with each trade it becomes a mess. What can I do? Can you give me an example on how to use properly that block? In the case of multiple trades being opened please...
-
@lllll Can you please share your project?
-
-
@lllll You need another 'For each trade' block between blocks 1 and 3.
-
I was wondering: lets say I open the first trade. is a buy. price goes down... every 100 pips it opens a trade (lets call it StepFactor), fast forward, lets say it opens 10 trades. The price retraces, the last trade becomes a profit and it closes in positive. We could apply a stop loss or a Close trade to whicever trade is negative of 900+ pips. To know these pips, we could apply a multiplication: 10 trades or 9 trades * our StepFactor. Could it work? I don`t know where to put these variables and how to configure those blocks. Could you help me guys?
-
@lllll I'm not sure that would be a succesful strategy in the long run. Have you tested manually at least?
-
Yeah I have. This type of grid can survive extremely trending periods (2008, 2014) and you can perhaps start with $300. There was an EA on the market, and has been taken out. Hence why I wanna replicate it.
-
@lllll But are you sure it was a grid structure? I haven't found any this is profitable for long periods. And what can you tell me about the period 2015-present?