Adding trailing stop loss for the strategy

MQL5 Indicadores Experts

Termos de Referência

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)

Arquivos anexados:

Respondido

1
Desenvolvedor 1
Classificação
(39)
Projetos
69
9%
Arbitragem
18
11% / 56%
Expirado
18
26%
Livre
2
Desenvolvedor 2
Classificação
(202)
Projetos
206
27%
Arbitragem
0
Expirado
3
1%
Livre
3
Desenvolvedor 3
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
4
Desenvolvedor 4
Classificação
Projetos
0
0%
Arbitragem
0
Expirado
0
Livre
Pedidos semelhantes
I WRITE a code i want to conect this for automatic trading through vps .and als advanced features for this code .i attached afile please watch .and give me perfect ea
Hello, I need a martingale and grid bot. The programmer must provide a test of about 5 minutes for the EA to see how it works and if everything is fine, it will be selected to make some modifications for personal use to that EA that you provide. If it has a lot of graphics or buttons. better It doesn't matter if the robot is bad, I'm more interested in its functionalities to use with my strategy
Hi Developer, I would like to create the Scalping EA based for Mt4 on the investing.com data https://www.investing.com/currencies/eur-usd-technical EA have timing to adjust time to trade. follow the broker time. From starting time to end time EA have a adjustable Lot size (0.01 incremental to 0.01) EA have a adjustable TP (1pip to 100pip incremental 1pip) EA have a adjustable SL (1pip to 100pip incremental 1pip) EA
Here is the Idea: I want a Semi Auto Trade Panel Manager EA that only activates when I press the BUY or SELL or BUY LIMIT or SELL LIMIT then the EA will do the rest : that includes the BUY STOP 0r SELL STOP and the hedging calculations according to below diagram. So overall , my only intervention is entering the lot size , hedge zone distance and TP ratio or entering the price for buy limit/sell limit then pressing
Hi, I'm looking for a martingale MT4 EA that performs a lot of trading volume per day. If you have the robot, you'll need to send me the demo so I can backtest it. Thank you very much
Hello potential Freelancers I’m very new to trading so please bear with me as I try to explain what ‘m looking for. I'm currently getting signals ( XAUUSD )sent to me and I’m looking to find a person who can look at the data either watch account live, or I send the trade history. The bot my provider is using makes 100’s of trades a day and does very well on average. I’m also looking to have the following features
Hello, I want to create an EA that can be able to take and optimise trade bids using the trend tracker concept I have developed. The tracker will monitor the 2 lines in the below pictures and then start to activate bids once they cross each other and then be able to manage all bids afterwards towards the direction of the market by opening and closing them intermittently and profitably until the position at the other
Hi man, How are u? I have an EA and I need to check few aspects of the code, if It works fine? I am looking for an expert coder, who can understand mt4 language and help us to solve this out. This job will hardly take about 3-4 hours max for an experienced coder, when explained detail. Also, I would like to give this to someone, who can understand and speak English well. Also, the coder should be able to come via
Hello The EA will work on particular zone choose by the user and can mark it on any TF and with some rules can open trades and mange the trade by some unique rules. the EA need to check the difference by RSI as well and with some extra rules . developer should have good attitude and good communication (englsih) with high performence and knowledge with coding EA. THREE TYPES OF ENTRIES 1: AGGRESSIVE 2: DIVERGENCE 3
Indicator in use: Bollinger Bands Mechanism: (See diagrams provided for help) Sells: 1. Trigger candle: When candle low is above the top Bollinger band - accurate to the point scale (e.g. On EURUSD if candle low is 1.07915 and the value of top bollinger is 1.07914 - this is a sell signal) 2. Enter sell ONLY on the next candle if price breaks below the trigger candle LOW (using the e.g. above- if next candle price

Informações sobre o projeto

Orçamento
30 - 35 USD
Desenvolvedor
27 - 31.5 USD
Prazo
de 1 para 2 dias