The EA closes a long-range order and all profitable orders if its loss is covered by profitable orders plus CloseProfit in the deposit currency.

A long-distance order is determined by the distance from the current price to the order.

Example:

We have 20 open positions, 3 of them in profit and 17 in loss. The loss of the furthest order is 5 USD and the profit of all (3) profitable orders in the amount of 6 usd. If CloseProfit = 1 usd (5=6-1), then we close the long-term unprofitable and all profitable ones on the current currency pair. Next, the Expert Advisor again determines a pair of unprofitable ones and waits for the profit of new orders to continue working.

Settings:

CloseProfit = 0; //close by total profit
Magic = 0; //-1 all orders.

The adviser works for free

Cm-CloseLock
Cm-CloseLock
cm-CloseLock.ex4
14.0 KiB
422 Downloads
Details