This Expert Advisor works in two modes – namely Stealth mode, and non-Stealth mode. In Stealth mode, (when STEALTH is set to TRUE), the take-profit, stop-loss, trailing and break-even stops are calculated and stored within the Expert Advisor. When the price touches these calculated values, the Expert Advisor automatically closes all the positions. The calculated values are not communicated to the broker server, and hence it provides an additional layer of privacy and security. However, in non-Stealth mode, the calculated values are updated to the server, and when the stop-loss or take-profit is hit, the server automatically closes the positions.
This Expert Advisor provides the following five features:
1. Initial Money Management –
a. The initial stop-loss of each position is set to STOP_LOSS points.
b. The initial take-profit of each position is set to TAKE_PROFIT points.
2. Breakeven Stop – When the open profit (in points) reaches the value specified by BREAKEVEN_GAIN, then the stop-loss is automatically set to a distance of BREAKEVEN points from the entry price.
3. Trailing Stop – When the open profit (in points) reaches the value specified by TRAILING_START, then the stop-loss is automatically set to distance of TRAILING_STOP points from the current price. From this point onwards the trailing stop trails the price by a distance of TRAILING_STOP points.
4. Profit Management for each Position – When the open profit of a position reaches the value specified by ORDER_PROFIT, that specific position is closed automatically.
5. Portfolio level Profit Management –
a. When the open profit (in percentage) reaches the value specified by PERCENT_OF_BALANCE, then all open positions are closed automatically.
b. When the open profit (in amount) reaches the value specified by PROFIT_AMOUNT, then all open positions are closed automatically.