Adding trailing stop loss for the strategy

MQL5 指标 专家

指定

I have attached a strategy below which I require you to add a trailing stop loss, there is an explanation below on how the trailing stop loss works, it is from the meta stock system tester in case you are wondering or have used it before.

All I require is the following stop loss to be added



Also, regarding the buy and sell condition it is available on the sheet



How does the Trailing Stop work?

The following is an example of a 2 point trailing stop, with and without a 3 bar delay:

A trade is triggered on a security. The entry price is 50. Over the next several bars, the price rises to 55. On the next bar, the price drops to 54. The following bar sees a drop to 52.5. Then the price rises to 53.5. From there, it continues to climb till it reaches 65. At this point, the price starts to fall rapidly. The next several bars have prices of 63, 61, 59, and 57 respectively.

A two point trailing stop, with no delay:

The trade is entered at 55. The stop moves up with the prices. When the price reaches 55, the stop is at 53. Two bars later, the stop is triggered and the trade is closed.

A two point trailing stop, with a 3 bar delay:

The trade is entered at 55. The stop moves up with the prices, but using the closing price from 3 bars prior to the current to calculate the stop level. Therefore, when the price begins to fall from the 55 bar high, the stop is being calculated from the price 3 bars earlier. It will not use the value of 55 till the prices have already moved back above 53 and the trade will remain open. When the prices reach 65 and begin to fall, the stop is still being used on the price 3 bars earlier. This means the prices will fall past 63, probably to 61 before being stopped out.



{Long trailing stop}

x:=1 { enter the trailing stop percent } ;

trade:= 1 { enter buy condition };

tep:=C; { trade entry price }

start:=ValueWhen(1,trade,tep);

r:=C-start;

lvl:= C-(r*(x/100));

stop:=If(trade,H-((H-tep)*(x/100)),

  If(ROC(C,1,%)>0,Max(lvl,PREV),PREV));

Cross(stop,L)



{Short trailing stop}

x:=1 { enter the trailing stop percent } ;

trade:= 1 { enter sell short condition };

tep:=C; { trade entry price }

start:=ValueWhen(1,trade,tep);

r:=start-C;

lvl:= C+(r*(x/100));

stop:=If(trade,L+((tep-L)*(x/100)),

  If(ROC(C,1,%)<0,Min(lvl,PREV),PREV));

Cross(H,stop)

附加的文件:

MQ5
RSI_MA_EA.mq5
12.6 Kb

反馈

1
开发者 1
等级
(4)
项目
5
0%
仲裁
3
0% / 67%
逾期
2
40%
空闲
2
开发者 2
等级
项目
0
0%
仲裁
0
逾期
0
空闲
3
开发者 3
等级
(33)
项目
35
40%
仲裁
11
9% / 91%
逾期
4
11%
空闲
相似订单
My trading over the years has become more and more mechanical. I would like to create some type of buy sell indicator based on time factors and reversal bars on 3 min and 6 min charts. I trade off 8 hour opens and fixed 15-45 min signal windows where the market typically shows a trigger. I will give you more details as needed please let me know if this make sense or sound feasible. Project: Time Based Reversals 1)
Hello Great Developer I have a free indicator from ninzaco that I want duplicated. I have attached a pic of it from ninzaco. I also attached some open source code. Part of it draws a line on the chart. I want to know what conditions/indicators are creating that line. IF you can tell me, then I want that indicator made to my specs with that line in it. can you duplicate the ninzaco BB% indicator? The source code
i am looking for experienced programmers who can help me out make my expert with zero lags and run smoothly and develop it in any possible way that make the accuracy way higher i need in addition to make this expert advisor linked on mt4 and mt5 also link the ea to WhatsApp and telegram bot where it giveS signals of the expert on it
I need an indicator that can plot buy and sell signals on the chart. Along with the arrows i also need that indicator draws some lines as well like for entry and SL(30 pips), TP1 (30 pips) , Tp2 (60 pips). I am attaching the screenshots for reference with detail. Now these are the two indicators that will be appended as marked with (1 and 2) on the chart. There are two scenarios that needs to be tacked in here
Hello Great Developer i need expert developer to create telegram signal copier to mt4 mt5 for my channel I am providing fx signals. So i will give license to my clients i want to build like this one Thanks
Need an experienced programmer to amend the following on exiting Bot 1: Amend Moving Average 3 angle calculation 2: Add MA 5, to be used with MA 2 and MA 4 3: Adjust “Time Start Trading” and “Time Stop Trading” 4: Amend working of Bollinger Band Attached are the amendments required. Bot file will be sent to selected programmer
Create this dashboard which measures Performance Monitoring, Broker Manipulation Detection, Trade Execution Data, basically account health. The images are an illustration of what it could look like but you can be creative. Key Functionalities include: Real-Time Monitoring: The dashboard should update in real-time or at specified intervals to show the latest performance metrics and account status. Alerts: Create an
Hello Anyone Who Can Code A Robot For Me With Power Of 3 Candles Sticks Stategys? or Anyone with A Powerful A Bot Up To Be Purchased … we can Edit There and There..im ready Anytime it Has To Be MT5
I have a ex4 custom indicator,, this There is no protection in it . I need the sourcecode of this file.so I need a reverse engineering expart,, Please contact me if you can figure out the code. Contact Me in telegram @Gw_rakib1
Hello, I’m looking for a TradingView indicator that fits my forex trading needs. If you can create or customize one for me, please reach out. I'd appreciate your help! Best regards ridynaty

项目信息

预算
30+ USD
开发人员
27 USD