Rediscovering profitable trades
The Expert Advisor analyzes all market positions for the pair on which it is thrown and trawls profitable ones. (Moves the stop loss behind the price at a TrailingStop distance above the opening price for Buy and below the opening price for Sell).
To all positions on which there is a stop loss (those that can no longer close at a loss), the ADVISER places limit orders at the price of their opening. The same lot as the open order.
Thus, the adviser each time re-opens positions with their lot at their price in case of closing a position on profit.
Example of work:
The buy 1.2345 position is open as soon as the price goes up more than TrailingStop+spread, the stop loss will be set at the order opening price and then will be pulled up for the price. At the same time, the adviser immediately places a buylimit order at the price of 1.2345 with the same lot as the open position. As soon as the price has turned around, the position is closed in the positive by the stop, the price still drops to 1.2345 and a repeat buy position is opened.
The adviser can control up to 100 open positions. Their direction doesn’t matter. For clarity, I made the opening of orders in the tester. That is, by running the Expert Advisor in the tester, you can see and understand its work visually.
The Expert Advisor works on a demo account for free, for a real account its price is 25 USD (2000 rubles)