This is an auxiliary Expert Advisor for your trading. It trails (not virtually) a profit of an aggregate position relative to the breakeven level by modifying SL and TP of all orders. The trading robot displays a breakeven level, minimum take profit line and trailing start line in case the number of orders in the market exceeds one and there is no "lock" (the total volumes of orders of the opposite direction are not equal to each other).
The main parameters are as follows:
- takeprofit - take profit relative to a level in points;
- distance - trailing distance (the distance between the current price and SL/TP order levels, in points);
- step trailing - trailing step, in points;
- magic Number - order ID.
You can check out the EA in MetaTrader 4 tester. The code provides the ability to place three orders of different directions and volumes. The most revealing day for tests is May 20, 2014, currency pair - USDJPY. You can also conduct tests on other currencies and dates.
Do not change default magic to ensure the EA's correct operation in the tester.