Partial Close and Virtual Trailing
- Utilidades
- Sergiy Podolyak
- Versión: 1.63
- Actualizado: 23 marzo 2020
- Activaciones: 10
PARTIAL CLOSE & VIRTUAL TRAILING Virtual trailing with partial position closing. ( Version MT5 )
ea-PartTrailing&Close is a fully automated Expert Advisor for tracking trades. Version =Simple= provides tracking of one BUY or SELL orders (or 1 Buy+1 Sell simultaneously). The EA is almost perfect at averaging profit and loss. StopLoss without TakeProfit is recommended since the latter may limit your profit in case of sharp price spikes.
The trailing is virtual since every movement of the levels responsible for a certain order part does not modify stop orders. What is a virtual tracking of orders with partial closing? Let's consider the version for a BUY order.
1234 (in this example, there are 4 parts of position closing).
- LevelsClose-------"05/10/15/20" (closing levels - 5 points, 10 points, 15 points, 20 points)
- PercentsClose----"30/30/20/20" (30% of lot closing, 30%, 20%, 20% -- totally, we have 100% and the order is fully closed).
When opening a BUY order, the levels are plotted below an order Open price at the distances set in LevelsClose. At each level, a part of an order set in PercentsClose is closed.
- An order is opened.
- The levels arrange below the order Open price at the distance: (1) level - 05 points, (2) -10 p. etc.
- The price moves up and all levels follow the price.
- The price reverses and starts moving down.
- The levels do not move and remain in place.
- The price crosses the level (1). 30% of the order is closed.
- If the price moves further down and breaks the level (2), 30% of the order is closed again.
- The price moves up again and the remaining two levels follow it.
- The price reverses and starts moving down.
- The price crosses the level (3). 20% of the order is partially closed.
The algorithm is repeated till all the levels set in the LevelsClose/PercentsClose parameters are broken through. The process itself is displayed on the screenshot N1-2. The entire EA operation is displayed in the video.
Inputs
_TRADE_Params_ = "=== TRADING PARAMETERS ==="
- LevelsClose - "05/10/15/20" Order partial closing levels (in points). If a Buy order is opened, the levels of the partial order closing are plotted below the Open price at the distances: first - 05 points, second - 10 points, third - 15 points, fourth - 20 points. The opposite is true for a Sell order.
- PercentsClose - "30/30/20/20" Order partial closing percentage (in % of a starting lot). The sum of all partial closing values should be 100% (30+30+20+20) so that an order is finally closed in full. Otherwise, part of an order remains.
Simple_Trailling - "=== Trailling ==="
- TrailingSBSMinus - allow virtual trailing with partial order closing
- TrailingStepMinus - trailing minimum step
_Other_Params_ - "=== Other Params ==="
- Magic - order magic number
- Slippage - allowable slippage
Language_ - "=== 0-English, 1-Cyrillic ==="
- Language - message language
_Only_Tester - "=== Params for Tester only ==="
- TesterBuy - open Buy for verification - works in the tester only
- TesterSell - open Sell for verification - works in the tester only
_Line_UPDN - "==== LineBuy / LineSell ===="
- InpColorBuy - color of the Buy order partial closing levels
- InpolorSell - color of the Sell order partial closing levels