거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Twitter에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
조회수:
8371
평가:
(23)
게시됨:
2018.03.01 11:54
이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

This non-trading Expert Advisor is designed for the simple trailing of take profit orders of open positions.

The EA only works on hedging accounts.

Principle of operation: when a new position is opened, the EA checks its take profit order. If there is none, the EA sets a take profit order at the size specified in the EA parameters. Then the EA starts to move the position take profit, if the price moves farther than the distance specified in the settings. Actions are similar to a simple stop loss trailing function.

You can set position type - any/buy/sell, the position symbol (any or the specified one), the magic number (any or the specified one) or the position ticket (any or the specified one). It is also possible to set the take profit trailing in the losing area - if this mode is not selected, take profit will not be trailed in the losing area, and will stop at the breakeven distance from the position open price. The breakeven value can be specified in the EA parameters.

To check the trailing operation in all modes, the EA can open positions on each new bar. This mode can only be applied in the Strategy Tester.

The EA has nine input parameters:

  • Take Profit size in points - take profit value in points. It is also used for TrailingTake as a distance between the stop order and the price;
  • Positions type - the type of positions to trail;
  • Positions symbol ("" - any symbol) - the symbol of the positions to trail (an empty value means all symbols);
  • Positions magic number (0 - any magic) - the magic number of positions to trail;
  • Position ticket (0 - all tickets) - the ticket of positions to trail;
  • Trailing step - if the price moves away from the position take profit at a distance greater than the step, take profit will be modified so as to have the size specified in Take Profit size in points;
  • Trailing in the unprofitable zone - enable or disable trailing in the losing area. If disabled, take profit will not be set in the loss zone;
  • Breakeven in points - breakeven value. A losing area starts below this value;
  • Spread multiplier - spread multiplier for calculating a correct distance for stop orders.
For Stop Loss and Take Profit orders (as well as pending orders), there is a minimum allowed distance for placing such orders - StopLevel. I.e. Stop Loss and Take Profit (as well as pending orders) cannot be placed closer than this distance to the price. If StopLevel is zero, it does not mean its absence, it only means that StopLevel is floating. In this case, the minimum distance is usually equal to spread*, but sometimes even the double spread is not enough. So, this parameter allows specifying a custom multiplier for the spread used to calculate the minimum distance for placing stop orders.

Fig.1 Testing take profit trailing of a Buy position. Take profit is equal to 400 points, trailing step = 10, trailing is only applied in the profitable zone.

MetaQuotes Ltd에서 러시아어로 번역함.
원본 코드: https://www.mql5.com/ru/code/19930

TimeEA TimeEA

A Simple Expert Advisor The EA opens a position of the specified type at the time specified in the EA parameters. The position is closed at the time specified in the appropriate parameter.

NTK 07 NTK 07

Implementation of multiple trailing types. Pending Buy Stop and Sell Stop orders. Limitation of the maximum total lot and the total number of positions. Several types of position volume calculation.

RndTrade RndTrade

Opening positions randomly after a certain time interval.

Ambush Ambush

The Expert Advisor uses Buy Stop and Sell Stop orders to trade news and large price movements.