Add stoploss to ea0130

İş Gereklilikleri

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

Yanıtlandı

1
Geliştirici 1
Derecelendirme
(20)
Projeler
19
11%
Arabuluculuk
2
50% / 50%
Süresi dolmuş
0
Serbest
2
Geliştirici 2
Derecelendirme
(586)
Projeler
918
46%
Arabuluculuk
31
39% / 29%
Süresi dolmuş
93
10%
Serbest
3
Geliştirici 3
Derecelendirme
(1)
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
1
100%
Serbest
4
Geliştirici 4
Derecelendirme
(37)
Projeler
59
27%
Arabuluculuk
25
20% / 52%
Süresi dolmuş
10
17%
Çalışıyor
5
Geliştirici 5
Derecelendirme
(68)
Projeler
77
8%
Arabuluculuk
33
9% / 55%
Süresi dolmuş
6
8%
Çalışıyor
6
Geliştirici 6
Derecelendirme
(255)
Projeler
312
37%
Arabuluculuk
6
50% / 17%
Süresi dolmuş
7
2%
Serbest
7
Geliştirici 7
Derecelendirme
(17)
Projeler
22
36%
Arabuluculuk
0
Süresi dolmuş
0
Çalışıyor
8
Geliştirici 8
Derecelendirme
(90)
Projeler
110
37%
Arabuluculuk
8
88% / 0%
Süresi dolmuş
0
Çalışıyor
9
Geliştirici 9
Derecelendirme
(4)
Projeler
4
100%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
10
Geliştirici 10
Derecelendirme
(13)
Projeler
18
28%
Arabuluculuk
2
0% / 100%
Süresi dolmuş
4
22%
Serbest
11
Geliştirici 11
Derecelendirme
(42)
Projeler
62
8%
Arabuluculuk
12
58% / 42%
Süresi dolmuş
1
2%
Serbest
12
Geliştirici 12
Derecelendirme
Projeler
0
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
13
Geliştirici 13
Derecelendirme
(5)
Projeler
6
17%
Arabuluculuk
0
Süresi dolmuş
0
Çalışıyor
14
Geliştirici 14
Derecelendirme
Projeler
1
0%
Arabuluculuk
0
Süresi dolmuş
0
Serbest
15
Geliştirici 15
Derecelendirme
(563)
Projeler
932
47%
Arabuluculuk
301
59% / 25%
Süresi dolmuş
124
13%
Çalışıyor
16
Geliştirici 16
Derecelendirme
(66)
Projeler
143
34%
Arabuluculuk
10
10% / 60%
Süresi dolmuş
26
18%
Serbest
17
Geliştirici 17
Derecelendirme
(126)
Projeler
182
54%
Arabuluculuk
3
33% / 33%
Süresi dolmuş
6
3%
Serbest
Benzer siparişler
So i have copier EA. The idea is the EA will triggered through manual OP by user via mobile or whatever platform. Let's say 0.01 lot to trigger it. After the EA takes master's position, the EA will be standby mode. If the master take more OP, the EA still not take the master's position (OP) until the user input manually once again via mobile for another 0.01 lot. Since this is a MT4 EA, Whenever user want to close
I need someone to develop an EA for MT5 to address the following issue: I trade using Local Trade Copier and have had problems with several of my receiver accounts. Sometimes, these accounts do not open the same number of positions, or they open double positions. So, I need an EA that can identify and show me which positions are not matching the positions opened on the master account (transmitter). Additionally
preciso de um robô com duas médias móveis, uma exponencial high e uma exponencial low. preciso também ter a opção de utilizar e todos os tempos gráficos e alterar os parâmetros das médias. entrada de compra será feita quando um candle de alta romper e fechar a cima da média high e fechará a posição quando um candle de baixa romper e fechar a baixo da média low. a venda será feita quando o candle de baixa romper e
Description - An expert advisor(s), placing sell trades in EUR/USD, based on the close price of the previous two candles, as shown in the figure below. The trades would be made in the 5 minute, 1 hour, and 1 day timeframes. In the 5 minute and 1 hour timeframes the market orders would be placed at the start of a new candle, at specific times EST. The order would be cancelled at the close of that candle, i.e after 5
Greetings, As the title suggests, I am trying to convert an indicator that calls itself via an iCustom call like this. iMAArray_Buffer[loop_1] = iCustom ( NULL , Selected_TF, MQLInfoString ( MQL_PROGRAM_NAME ), "calculate" , RPeriod, MType, MPeriod, 1 , shift); Full code will not be provided, only the position that needs fixing. I cannot get this working in MQL5 but the original code runs smoothly in MQL4. Please
Hi, I have an indicator from my friend, I want to copy it to my own Traidingview or MT5 can you do that for me. Here is the link
Hi, I have an indicator from my friend, I want to copy it to my own Traidingview or MT5 can you do that for me. Here is the link
Greetings great developer, I am in search of a highly skilled developer to assist with an exciting project. I need to convert two open-source TradingView indicators to NinjaTrader 8 and implement a usage restriction based on computer IDs. If you have experience with NinjaTrader 8 coding please let me know. I’d be happy to discuss the details further
Greetings great developer, I am in search of a highly skilled MQL5 developer to assist with an exciting project. I need to convert two open-source TradingView indicators to NinjaTrader 8 and implement a usage restriction based on computer IDs. If you have experience with NinjaTrader 8 coding please let me know. I’d be happy to discuss the details further
Hi, I need a robot, which wil get instructions to trade in 3 symbols at the same time based on few parameters and calculations. Example: There is 1 symbol called Gold-Near and the rate for it is 1000-1002 If i specify that when the rate reaches 1050, it should sell 1 lot Upon execution it will have to sell 1 lot of cme gold, buy 3 lots of mcx gold and buy currently (lots will be based on calculation). All the

Proje bilgisi

Bütçe
30+ USD
Geliştirici için
27 USD