The Close Symbol with Profit or Loss Expert Advisor is a instrument (symbol) level VertexFX client-side script that exits all open positions for the current symbol if it reaches the specified profit or loss amount.
In many situations it is necessary to track the net open positions of a symbol as a group to ensure safe money management. Although individual positions may be opened by different Expert Advisors, or even manually, the trade may choose to enforce profit and loss limits for the symbol to avoid huge volatility. In such a scenario, the Close Symbol with Profit and Loss Expert Advisor comes handy.
When the total profit amount (in account currency) of all open positions of the current symbol is greater than or equal to the parameter TP For Symbol value, then all the open positions for the current symbol are closed at once, thus protecting the profits.
Similarly, when the total loss amount (in account currency) of all open positions of the current symbol is greater than or equal to the Parameter SL For Symbol value, then all open positions for the current symbol are closed at once, thus protecting the account from further loss.
Please note that this Expert Advisor does not track or delete pending orders of the current symbol when closing the open positions.