• 概述
  • 评论 (2)
  • 评论 (20)
  • 新特性

TrailingByPercentOfProfit

The Expert Advisor trails open positions based on the symbol it is running on. Once the position profit exceeds a value specified in the settings, trailing stop is switched on. The stop level is trailed at the amount equal to the preset percent of profit. If, for example, profit is 100 points, and the trailing value specified in the settings is 75%, then the stop level is trailed by 75 points. Trailing is enabled when some profit specified in the setting is gained. For example, if the trailing trigger threshold is set at 20 points, when when profit exceeds 20 points the trailing function is switched on, which trails the stop level for a value of 15 points (75% of twenty).


Parameters

Position parameters:

  • MagicNumber (-1 == all positions) - the magic number of the orders to trail. For example, 100500 - it will trail the stops of the EA that opens positions with the magic number 100500. If you enter -1, all available market positions will be trailed.

Trailing parameters:

  • Pips profit to run trailing - the trailing trigger level. Once the position profit in points exceeds the value, the EA will trail the position stop by an amount set by the following parameter:
  • Saved percentage of profit - percent of profit that should be saved by setting a stop at this level. If set to 75, then when the profit of 100 points is reached, the stop will be set to 75 points. I.e. it saves 75 percent of the existing profit. Upon reaching 150 points of profit, the stop is trailed by 112 points, for 200 pips - stop is set at 150 points. All these values ​​are only examples. This does not mean that stop is moving discretely when it reaches certain values. The stop is continuously trailed. I.e. the existing fixed income is regularly locked by trailing the position stop by the amount specified by this paragraph settings. The only limit to the stop movement is the following parameter:
  • Steps trailing in points. To avoid trade server overloading by sending constant requests to modify stop loss at each tick, this limitation is used. If the stop has been trailed, now the next modification will be made only after the next stop level will differ from the current one by a predetermined number of points. If set to 3 points, and stop is at 100 points, the next stop modification will only happen when the percent of the saved profit is more than 103 pips.

Additional parameters:

  • Draws graphics Yes/No - show/hide graphic representation of the trailing start levels and the level of calculated saved profit level.
  • Color level for Buy
  • Color level for Sell
  • Show objects descriptions Yes/No - show/hide information about the ticket of the trail start level (the ticket of the position to which the level belongs is show on the left of the level). This parameter should be used only when graphics is allowed (Yes in the Draws graphics parameter).
  • Descriptions text size.

Trade order parameters:

  • Number of attempts to trade on failure - the number of attempts to trade in case of trade request execution error. If the server returns some modification error, the EA processes the code returned by the server and sends a second request adjusted under the new conditions. The number of attempts is set in this parameter.
  • Slippage - price slippage. This is the difference of the price sent in a trade request and the price of the execution returned by the trade server. If they differ by no more than the specified number of points, the level will be modified. If the difference is greater, the EA will try to do a second trade request (as many times as specified in the parameter Number of attempts to trade on failure)
  • Use sound Yes/No - a sound alert on execution of trade operations.
nikolai82
384
2015.12.09 20:22 
 

Спасибо автору за такой хорошего и доступного помощника!!!

Dmitriy Zaripov
167
2015.03.12 09:56 
 

Спасибо. Хорошо помогает в торговле!

版本 1.1 - 2015.12.24
Redesigned for the new mql4, bug fixes based on users' comments.