Closing long-distance positions due to accumulated profit

The expert Advisor analyzes the profit for a certain time and closes partially or completely long-distance losing positions due to this profit.The EA works immediately with all positions opened on this account (for all currencies). Records the accumulated funds in memory starting from the date specified in the parameters. From this profit, the adviser leaves a part (set in the parameters of the adviser), and all over it spends on partial or complete closure of the most distant positions.
the farthest position is considered to be the one that is separated from the current price by the maximum number of points or has the largest loss in the currency (at your choice).
If the amount in excess of the minimum balance exceeds the loss of the part of the far position, the EA closes this part. (bites off the specified lot size).
in order for the EA not to close just opened positions, it added the “minimum loss of the transaction to be closed (point)” item in the settings.
if you set 100P, the EA will not bite positions until they reach a loss of 100 p. at the same time, the position is highlighted in gray in the EA window.When the EA is turned on, it goes into standby mode. In this mode, he calculates everything and displays it on the screen, but he does not close anything.

Cm Close Far 2.7
Cm Close Far 2.7
cm-close-far-2.7.ex4
41.4 KiB
163 Downloads
Details