Adding trailing stop loss for the strategy

Техническое задание

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)

Файлы:

Откликнулись

1
Разработчик 1
Оценка
(39)
Проекты
69
9%
Арбитраж
18
11% / 56%
Просрочено
18
26%
Свободен
2
Разработчик 2
Оценка
(204)
Проекты
209
28%
Арбитраж
0
Просрочено
3
1%
Свободен
3
Разработчик 3
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
4
Разработчик 4
Оценка
Проекты
0
0%
Арбитраж
0
Просрочено
0
Свободен
Похожие заказы
BUY AND SELL 30+ USD
Create an Expert Advisor that collaborates between these indicators ETR, MEv2 and STLv3 with these features 1. SL and TP 2. TIME FILTER 3. ETR, MEv2 and STLv3 PARAMETERS BUY ENTRY STEP 1. FIRST candle OPEN above Symphonie Trend Line STEP 2. Check Symphonie Extreme must indicate color BLUE STEP 3. Check Symphonie Emotion must indicate color BLUE STEP 4. Open trade with money management STEP 5. Trade open MUST BE 1
Hello, I have a protected Ninja trader Order Flow indicator and I was wondering if you can reverse engineer it to replicate the functionality. H ere are the specifications and indicator: https://docs.google.com/document/d/1KyYwQ7iTL2KWGhnZzxS1gObccu9LPMrGuMc9Mdk_3KY/edit?usp=sharing
I have an EA that need some changes including integrating the indicator code directly into the Expert Advisor. I will give the detailed doc once we settle on the candidate for the job . Please bid if you can work with the stated amount. Thanks
Hello, Need to convert Tradingview Indicator to MQL4 indicator. or if you have this one converted already, let me buy a copy please. If we're good, then will definitely buy it and ask to convert into EA on new order. Supertrend by KivancOzbilgic
Fix bug or modify an existing Trading view indicator to display correct. The indicator is working but not displaying/plotting all the information i want. So i want it adjusted to plot all the info
Here's a brief requirement you can use: **Description:** I am seeking an experienced MQL5 developer to create a (EA). The EA should include features for placing pending orders (Buy Stop and Sell Stop) based on market spread, managing trades effectively at the opening of new candlesticks, and implementing take profit and stop loss strategies. Additionally, I would like the option to adjust parameters based on market
I have an EA which i need to do below modifications. Variable Inputs to be added Order Type : Market , Pending Trade Type : Buy, Sell , Buy & Sell Pending Pips Step : ( Pips Value can be negative or positive to decide on what type of Pending Order ) // If trade type Buy is selected Close Type : Close All ( Bulk Close Option in MT5 ) , Close Individually Close Option : %of Equity , %of Balance , Amount $ , %of No
Add multiplier to grid recovery system. For example: Grid Trade 2-3 Spacing; 1.0 Multiplier Grid Trade 4-6 Spacing; 2.0 Multiplier Grid Trade 7+ Spacing; 1.6 Multiplier Need quick turn around. Need it done ASAP
Objects reader PIN 70 - 100 USD
Hi I have an indicator that create objects in the chart and using those following some rules the new indicator will create external global variables with value = 0 ( NONE ), = 1 ( BUY ) or = 2 ( SELL ). The global variable will use PIN external integer number . PINS are by now global variables (GV) whose name indicates the pair name and the PIN belonging and their value indicates it direction/action. PINS GV names
I want an indicator and its source code that returns the value of: - two moving averages in different selectable timeframes, with method Exponential and price calculation price_open; - Opening, closing, maximum and minimum of the candle in different timeframes And that returns the values ​​regardless in a chart of one minute. The input parameters: * select timeframe media1 = {1,2,3,4,5,...} * select timeframe media2

Информация о проекте

Бюджет
30 - 35 USD
Исполнителю
27 - 31.5 USD
Сроки выполнения
от 1 до 2 дн.