Closing oldest trades on specific event
-
Hi there!
I want to test a trading system where losable trades are never closed unless they are compensated.
To do this, when i open a new trade i also open an opposite pending at the distance of my wanted "stop loss". In this way, when the trade goes bad, i freeze the loss by hedging. Then, every new trade has a trailing stop with same size of the pips distance between each hedging couple. What i want to do is to close the oldest couple of hedging trades each time that the trailing stop moves the SL.
I wrote the system and it seems to be ok unless that i can't close the oldest couple of orders.
I tried to realize it using a "trade SL modified" under "on trade" section. I connected a loop to this block where the sequence is: for each trade, oldest to newest, no more than 2 trades, close trades... but this is not working
I also tried to place the same loop "on tick", with using other ways to identify the condition where oldest orders must be closed but i have no results.Where is the mistake? Or... what could be the right way to achieve the result?
Here the link to the project: https://fxdreema.com/shared/obdqfrjjbThanks for the help and happy sunday!
Malfy