Close all trades when the price returns to where one of them was opened.
-
Good morning group, I need help. I explain what I want to do:
The price goes up and at a certain moment I decide to open a sale (operation 1), the price continues to rise and exceeds X pisp, so I decide to open another sale (operation 2), and so on until I have 6 open operations for sale. The price finally decides to come back in my favor. How do I make it so that when the price reaches the level at which trade 3, 2 or 1 (whichever I decide) was opened, all are closed?
Attached image of an example where 5 operations are opened and when the price goes back and reaches the price where the 2nd operation was opened, all must be closed.

How do I tell fxdreema that when the price reaches one of my previously opened trades to close them all at that point?
-
@kamux said in Close all trades when the price returns to where one of them was opened.:
Good morning group, I need help. I explain what I want to do:
The price goes up and at a certain moment I decide to open a sale (operation 1), the price continues to rise and exceeds X pisp, so I decide to open another sale (operation 2), and so on until I have 6 open operations for sale. The price finally decides to come back in my favor. How do I make it so that when the price reaches the level at which trade 3, 2 or 1 (whichever I decide) was opened, all are closed?
Attached image of an example where 5 operations are opened and when the price goes back and reaches the price where the 2nd operation was opened, all must be closed.

How do I tell fxdreema that when the price reaches one of my previously opened trades to close them all at that point?
The idea is that if I happen to have 3 trades open, and the price pulls back, they should all be closed when the price hits the first trade. If there are 4 open, they close if it reaches the 2nd, if there are 5 open, close all in the 3 and so on.
-
@kamux You will definitely need a variable to store the open price you are looking for. That is easy. The problem is deciding when you consider price is 'moving back'. Because that can happen just one second after the trade was open. How much time is supposed to happen in between?
-
@l-andorrà Thanks friend for replying.
I thought that there was some simple way to identify the position of each open operation, since by variables, the design becomes very extensive. And to know when the price is returned there is no problem, since this is not required, it is only knowing if the price, after having open X positions, reaches one of the first open positions, that's all.