Add stoploss to ea0130

Tarea técnica

//+------------------------------------------------------------------+
//|                                                     MyEA.mq5     |
//|                        Copyright 2024, Your Company Name        |
//|                                       http://www.yourwebsite.com|
//+------------------------------------------------------------------+
#property copyright "2024, Your Company Name"
#property link      "http://www.yourwebsite.com"
#property version   "1.00"
#property strict

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
   // Place your initialization code here
   return INIT_SUCCEEDED;
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
   // Place your deinitialization code here
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
   // Place your trading logic here
   double stopLossDistance = 30.0; // Stop loss distance in pips
   double stopLossPrice = 0.0;     // Stop loss price
   double entryPrice = Ask();      // Get current ask price (assuming long trade)

   // Calculate stop loss price
   if (stopLossDistance > 0)
     {
      stopLossPrice = entryPrice - stopLossDistance * Point;
     }

   // Place stop loss order
   if (stopLossPrice > 0)
     {
      int ticket = OrderSend(Symbol(), OP_BUY, 0.1, entryPrice, 2, stopLossPrice, 0, "Stop Loss", 0, 0, clrNONE);
      
      if (ticket > 0)
        {
         Print("Stop loss order placed successfully at price ", stopLossPrice);
        }
      else
        {
         Print("Error placing stop loss order: ", GetLastError());
        }
     }
  }
//+------------------------------------------------------------------+

Han respondido

1
Desarrollador 1
Evaluación
(20)
Proyectos
19
11%
Arbitraje
2
50% / 50%
Caducado
0
Trabaja
2
Desarrollador 2
Evaluación
(595)
Proyectos
927
46%
Arbitraje
31
39% / 29%
Caducado
93
10%
Trabaja
3
Desarrollador 3
Evaluación
(1)
Proyectos
1
0%
Arbitraje
0
Caducado
1
100%
Libre
4
Desarrollador 4
Evaluación
(37)
Proyectos
59
27%
Arbitraje
25
20% / 52%
Caducado
10
17%
Trabaja
5
Desarrollador 5
Evaluación
(71)
Proyectos
80
10%
Arbitraje
35
9% / 54%
Caducado
6
8%
Trabaja
6
Desarrollador 6
Evaluación
(257)
Proyectos
314
37%
Arbitraje
6
50% / 17%
Caducado
7
2%
Libre
7
Desarrollador 7
Evaluación
(18)
Proyectos
24
42%
Arbitraje
0
Caducado
0
Trabaja
8
Desarrollador 8
Evaluación
(95)
Proyectos
117
38%
Arbitraje
9
89% / 0%
Caducado
0
Libre
9
Desarrollador 9
Evaluación
(4)
Proyectos
4
100%
Arbitraje
0
Caducado
0
Libre
10
Desarrollador 10
Evaluación
(13)
Proyectos
18
28%
Arbitraje
2
0% / 100%
Caducado
4
22%
Trabaja
11
Desarrollador 11
Evaluación
(42)
Proyectos
62
8%
Arbitraje
12
58% / 42%
Caducado
1
2%
Libre
12
Desarrollador 12
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
13
Desarrollador 13
Evaluación
(5)
Proyectos
6
17%
Arbitraje
0
Caducado
0
Libre
14
Desarrollador 14
Evaluación
Proyectos
1
0%
Arbitraje
0
Caducado
0
Libre
15
Desarrollador 15
Evaluación
(563)
Proyectos
932
47%
Arbitraje
302
59% / 25%
Caducado
124
13%
Trabajando
16
Desarrollador 16
Evaluación
(66)
Proyectos
143
34%
Arbitraje
10
10% / 60%
Caducado
26
18%
Libre
17
Desarrollador 17
Evaluación
(127)
Proyectos
183
55%
Arbitraje
3
33% / 33%
Caducado
6
3%
Libre
Solicitudes similares
Hello I need a very simple indicator This indicator should show the highest floating or history drawdown of the account It means that it can display the highest number that the account drawdown to be displayed on the chart in this format max drawdown account(xxxx$$) ...date(00/00/00)time:(00:00) max drawdown currency ..( currency name with max drwadown) . (xxxx$$) date(00/00/00)time:(00:00) thanks
I want have the possibility to increase lotsize not alone by Lot-multiplier rather I want add a fix-lot increase for excample for 0,05 lot. I want have this for buy / sell and hedge-buy and hedge sell
Hello, I‘m interested in an indicator to predict the next candles probability (bullish or bearish). But honestly I have no idea how to do this. Would be interested in your opinion how we can create such an indicator. Please let me know if you‘ve done similar work
Profitable EA HFT 50 - 300 USD
From a long time i am searching for a profitable EA i have lost a lot , and now i have only 300$ to buy a profitable EA , i wish to say with 0 losses but some or most traders they don't want to hear this i am really tired of searching for a programmer to just create me a profitable EA with the least losses or zero losses maybe nearly 1 year i am searching i just need an HFT EA that can work very well on MT4,MT5
у нас есть стратегия, нам нужно написать mql5-код ​​для тестера стратегий МТ5,Цена договорная. Мой контакт @abbosaliyev из Telegram Программист должен знать РУССКИЙ ИЛИ УЗБЕКСКИЙ язык. Задание: разработать тестер, который использует шаблон условий на открытие и проверит весь исторический график на всех доступных таймфреймах. Остальная информация будет предоставлена ​​после согласования цены
New york session based strategy 9:30 open Price takes out buy side or sell side liquidity Usually using 15min high and lows 5m entry Price takes out that high/low and price must close strongly back into the zone Is price is above price we have a sell bias vis versa for buys Sl is at the high or low with option for “offset” for cushion Tp is usually the opposite High or low. Would like the option for set pips-points &
Utilizing the MQL5 MetaEditor Wizard, I created an Expert Advisor, having the following Signal indicators: I was able to optimize the EA and reached a backtest with the following specifications: I was able to reach a profit level of 30K, as indicated below. However, the Bot is not without faults and following the backtest, I started a forward test with real live data and the results were not so great. The EA took a
Hey greetings. Am in need of a developer that has already made profitable MT4 or MT5 EA that I can buy with the backtesting and proven result. How is the draw down ? What is the winning rate ? Kindly reply and let proceed
I will buy your EA for MT5, in case that on distance it is able to make a profit of 10% per month. - Martingale methods and grid strategies should not be used as the basis of a trading strategy. - Excellent win rate (>80%) - High risk/loss management - Option to select direction of trading (long, short or both) - News filter - Editable Trading Hours I will need to test in the strategy tester and on live market (on
Looking for an experienced developer to modify my existing TDI strategy , want to add filter for Buy and Sell Signals, Arrows are displayed on chart and what only to leave high accurate arrows Source code to be provided

Información sobre el proyecto

Presupuesto
30+ USD
Para el ejecutor
27 USD