Adding trailing stop loss for the strategy

MQL5 Indicators Experts

Specification

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)

Files:

MQ5
RSI_MA_EA.mq5
12.6 Kb

Responded

1
Developer 1
Rating
(4)
Projects
5
0%
Arbitration
3
0% / 67%
Overdue
2
40%
Free
2
Developer 2
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
3
Developer 3
Rating
(33)
Projects
35
40%
Arbitration
11
9% / 91%
Overdue
4
11%
Free
Similar orders
I'm seeking assistance in developing a sophisticated trading robot with the following features: Core strategy: Harmonic pattern recognition Supply and demand analysis Fibonacci zigzag for trade optimization Additional components: News filter Dashboard for easy monitoring Customizable settings: Lot size Trailing stop Trading session parameters Maximum number of orders Option to use market or limit orders Resources
1. Add Feature For (SPREAD) Normal trading Hours Spread or User set trading Hours Spread True or false Set to true or False When set to true EA will only create or develop a trade if spread is in this window allowing it to and EA will follow a window in which it can trade based on spread so if spread is to high and outside of this window it will not create a trade It
I am looking for a programmer to do EA trader. If you can understand what I want from the video i do and you can do it, contact me because you will be able to do what I want. https://drive.google.com/file/d/1wbHxbUQQqCkdpr0-pHfIh2b288LzYTV2/view?usp=sharing
Hi, I have an indicator from my friend, I want to copy it to MT5 can you do that for me. Here is the link
Hi, I have a working MQ4 EA (With a few warnings but works fine), I need the warnings cleared and converted to MQ5. But I would also like a few improvements first. Firstly: Fix warnings in MT4 code (return value of 'OrderSelect'/'OrderModify' should be checked). Add following features: Magic number modifiable variable (It's currently hard coded) Is it possible to have a stop loss dollar amount instead of lots if
i create a robot which help with order blocks and detection of spikes ....simply it analyses the market for you and if you are using it you wont need much skill to start operating it well you just need to know and understand how it works
I need an experienced programmer to create an automated EA that will open trades based on different candle stick formation strategies and indicators. The EA will first scan the market, find a current market trend and define area of support and resistance. On ranging market the EA doesn’t place trades . (1) EA should use a straddle strategy from either the S/R level, (2) indecision Doji candle from the S/R area, (3)
Order of EA trading only Arrow signals of my indicator in MT4 This EA should trade only the BUY and SELL Arrow signals after 1 added candle AND only if the bricks (blue for blue and red for sell) are in same direction Arrow + a brick Indicator is here attached. Arrow up + 2 Bricks Blue is BUY Arrow down + 2 Bricks Red is SELL Important is to check ONLY CLOSED candels. Sometimes it maybe occur ,that arrow apperase
Je souhaite un Ea advisor, possédants des stratégies combinés tels que : RSI+BB, Stoch+ATR, Fibonacci pattern harmonics, Keiltner+Canal Donchian, EMA+SMMA, support et résistance,zizag Min lots : 0.1 Je rechargerai mon solde une fois qu’un bon robot me sera présenté Je 'ai qu’une centaine d’euro entre mon investissement en votre EA et mon solde métatrader je ne veux pas de calcul de lots en fonction de mon
Hi, I have an indicator from my friend, I want to copy it to MT5 can you do that for me. Here is the link

Project information

Budget
30+ USD
For the developer
27 USD