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

This is a simple Expert Advisor with an implemented trailing stop.

It has only two parameters:

TrailingStop Inputs 

TrailingStop — the distance between the price and the Stop Loss level.

TrailingStep — protection against to frequent modification of position. 

How TrailingStop works — the example of the Buy position: 

Originally the StopLoss of a position is equal to zero, we wait for the following condition to be met

                  if(m_symbol.Bid()-ExtTrailingStop>m_position.PriceOpen())

— i.e. when the Bid minus TrailingStop is greater than the position open price PriceOpen:

TrailingStop sl to priceopen

StopLoss is moved to the PriceOpen level (position open price):

TrailingStop sl to priceopen result.png

now, when the position has StopLoss (i.e. when StopLoss is not equal to zero), wait for the following condition to be met:

                  if(m_symbol.Bid()-ExtTrailingStop-ExtTrailingStep>m_position.StopLoss())

— i.e. when the Bid minus TrailingStop minus TrailingStep is greater than the StopLoss price: So here we need to additionally check TrailingStep — this prevent position modification on every tick:

TrailingStop trailing

StopLoss is then moved to Bid minus TrailingStop:

TrailingStop trailing result.png 

Here is why we need a protection in the form of TrailingStep:

TrailingStop non trailing 

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

Reconstruction of positions Reconstruction of positions

An example of working with the trading history on Hedge accounts — reconstruction of positions.

BIG DOG BIG DOG

The EA places pending stop orders BUY_STOP and SELL_STOP.

AIS1 AIS1

The EA works based on the analysis of Open, High and Low.

NRTR GATOR NRTR GATOR

Derived from the NRTR indicator, provided with a new visual display.