거래 로봇을 무료로 다운로드 하는 법을 시청해보세요
당사를 Facebook에서 찾아주십시오!
당사 팬 페이지에 가입하십시오
스크립트가 흥미로우신가요?
그렇다면 링크 to it -
하셔서 다른 이들이 평가할 수 있도록 해보세요
스크립트가 마음에 드시나요? MetaTrader 5 터미널에서 시도해보십시오
Experts

Break-Even and Trailing Stop Manager for Open Positions - MetaTrader 5용 expert

Kenichiro Sakamoto
Kenichiro Sakamoto
5 (2)
저는 Kenichiro Sakamoto이며, MetaTrader 5용 투명하고 규칙 기반의 EA(Expert Advisor)를 만드는 스튜디오 FXEA365의 개발자입니다.
조회수:
74
게시됨:
MQL5 프리랜스 이 코드를 기반으로 한 로봇이나 지표가 필요하신가요? 프리랜스로 주문하세요 프리랜스로 이동

This Expert Advisor does not open any trades. It watches the positions that are already open on the account, whether they were opened manually, from the mobile terminal or by another Expert Advisor, and manages only their stop loss. The take profit of each position is kept unchanged.

The logic has two stages. When a position gains the number of pips set in the break-even trigger, its stop loss is moved to the open price plus a small locked profit. After that the trailing stop follows the price at a fixed distance in pips or at a multiple of ATR, and the stop loss is moved only in the direction of profit.

Fig. 1. The manager attached to a EURUSD H1 chart

Input parameters

  • InpAllSymbols - manage positions of all symbols (true) or only of the chart symbol (false).
  • InpMagic - manage only positions with this magic number; 0 means all positions.
  • InpUseBreakEven - enable the break-even stage.
  • InpBETriggerPips - profit in pips that moves the stop loss to break-even.
  • InpBELockPips - profit in pips locked in when the stop loss is moved to break-even.
  • InpUseTrailing - enable the trailing stop.
  • InpTrailMode - trailing distance as fixed pips or as an ATR multiple.
  • InpTrailPips - trailing distance in pips for the fixed mode.
  • InpATRPeriod and InpATRMultiplier - ATR period and multiplier for the ATR mode (the ATR is read on the chart timeframe).
  • InpStepPips - the stop loss is moved only when it improves by at least this many pips, which reduces the number of modification requests.

How to use it

Attach the Expert Advisor to one chart and allow algorithmic trading. For a single symbol keep InpAllSymbols set to false. To protect positions on several symbols from one chart, set it to true; the timer runs every second, so positions on other symbols are managed even when the chart symbol has no new ticks.

One pip is 10 points on 3 and 5 digit quotes and 1 point on other symbols. Before each modification the new stop loss is checked against the stops level of the symbol, so requests that the server would reject are not sent. The trailing stop starts only when the new stop loss is beyond the open price.

Symbol Specification Probe - tick size, tick value, money value of a stop Symbol Specification Probe - tick size, tick value, money value of a stop

The probe prints the values a symbol specification supplies: digits, point, trade tick size, trade tick value, contract size, volume minimum, volume maximum, volume step and the stops level. Trade tick size is the smallest price change the instrument can make, trade tick value is the money one tick is worth for one lot, and the stops level is the minimum distance in points the reference gives for a stop away from the current price. It then prices a stop at the volume you enter, taking the pip as ten points on a 3- or 5-digit symbol and one point on every other symbol: the pip count times the pip gives a price distance, the distance over the trade tick size gives ticks, and ticks times trade tick value times volume gives the money.

Gaussian Auto EA Gaussian Auto EA

Trend-following breakout EA using a Gaussian-filtered channel, ATR bands, risk-based lot sizing, and an R-multiple trailing stop.

Equity Drawdown and Daily Loss Guard Equity Drawdown and Daily Loss Guard

Utility Expert Advisor that closes all open positions when equity falls a set percentage below its peak or when today's loss reaches a limit. It never opens trades.

One-Click Buy Sell Close Panel with Pip Stops One-Click Buy Sell Close Panel with Pip Stops

Chart panel Expert Advisor with BUY, SELL and CLOSE buttons. Market orders use a fixed lot with stop loss and take profit in pips, and the panel shows the floating profit of its trades.