Add stoploss to ea0130

Spécifications

//+------------------------------------------------------------------+
//|                                                     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());
        }
     }
  }
//+------------------------------------------------------------------+

Répondu

1
Développeur 1
Évaluation
(20)
Projets
19
11%
Arbitrage
2
50% / 50%
En retard
0
Travail
2
Développeur 2
Évaluation
(595)
Projets
927
46%
Arbitrage
31
39% / 29%
En retard
93
10%
Travail
3
Développeur 3
Évaluation
(1)
Projets
1
0%
Arbitrage
0
En retard
1
100%
Gratuit
4
Développeur 4
Évaluation
(37)
Projets
59
27%
Arbitrage
25
20% / 52%
En retard
10
17%
Travail
5
Développeur 5
Évaluation
(71)
Projets
80
10%
Arbitrage
35
9% / 54%
En retard
6
8%
Travail
6
Développeur 6
Évaluation
(257)
Projets
314
37%
Arbitrage
6
50% / 17%
En retard
7
2%
Gratuit
7
Développeur 7
Évaluation
(18)
Projets
24
42%
Arbitrage
0
En retard
0
Travail
8
Développeur 8
Évaluation
(95)
Projets
117
38%
Arbitrage
9
89% / 0%
En retard
0
Gratuit
9
Développeur 9
Évaluation
(4)
Projets
4
100%
Arbitrage
0
En retard
0
Gratuit
10
Développeur 10
Évaluation
(13)
Projets
18
28%
Arbitrage
2
0% / 100%
En retard
4
22%
Travail
11
Développeur 11
Évaluation
(42)
Projets
62
8%
Arbitrage
12
58% / 42%
En retard
1
2%
Gratuit
12
Développeur 12
Évaluation
Projets
0
0%
Arbitrage
0
En retard
0
Gratuit
13
Développeur 13
Évaluation
(5)
Projets
6
17%
Arbitrage
0
En retard
0
Gratuit
14
Développeur 14
Évaluation
Projets
1
0%
Arbitrage
0
En retard
0
Gratuit
15
Développeur 15
Évaluation
(563)
Projets
932
47%
Arbitrage
302
59% / 25%
En retard
124
13%
Chargé
16
Développeur 16
Évaluation
(66)
Projets
143
34%
Arbitrage
10
10% / 60%
En retard
26
18%
Gratuit
17
Développeur 17
Évaluation
(127)
Projets
183
55%
Arbitrage
3
33% / 33%
En retard
6
3%
Gratuit
Commandes similaires
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

Informations sur le projet

Budget
30+ USD
Pour le développeur
27 USD