Add stoploss to ea0130

명시

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

응답함

1
개발자 1
등급
(20)
프로젝트
19
11%
중재
2
50% / 50%
기한 초과
0
무료
2
개발자 2
등급
(586)
프로젝트
918
46%
중재
31
39% / 29%
기한 초과
93
10%
무료
3
개발자 3
등급
(1)
프로젝트
1
0%
중재
0
기한 초과
1
100%
무료
4
개발자 4
등급
(37)
프로젝트
59
27%
중재
25
20% / 52%
기한 초과
10
17%
작업중
5
개발자 5
등급
(68)
프로젝트
77
8%
중재
33
9% / 55%
기한 초과
6
8%
작업중
6
개발자 6
등급
(255)
프로젝트
312
37%
중재
6
50% / 17%
기한 초과
7
2%
무료
7
개발자 7
등급
(17)
프로젝트
22
36%
중재
0
기한 초과
0
작업중
8
개발자 8
등급
(90)
프로젝트
110
37%
중재
8
88% / 0%
기한 초과
0
작업중
9
개발자 9
등급
(4)
프로젝트
4
100%
중재
0
기한 초과
0
무료
10
개발자 10
등급
(13)
프로젝트
18
28%
중재
2
0% / 100%
기한 초과
4
22%
무료
11
개발자 11
등급
(42)
프로젝트
62
8%
중재
12
58% / 42%
기한 초과
1
2%
무료
12
개발자 12
등급
프로젝트
0
0%
중재
0
기한 초과
0
무료
13
개발자 13
등급
(5)
프로젝트
6
17%
중재
0
기한 초과
0
작업중
14
개발자 14
등급
프로젝트
1
0%
중재
0
기한 초과
0
무료
15
개발자 15
등급
(563)
프로젝트
932
47%
중재
301
59% / 25%
기한 초과
124
13%
작업중
16
개발자 16
등급
(66)
프로젝트
143
34%
중재
10
10% / 60%
기한 초과
26
18%
무료
17
개발자 17
등급
(126)
프로젝트
182
54%
중재
3
33% / 33%
기한 초과
6
3%
무료
비슷한 주문
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
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
Trading bot 300+ USD
We need bot that trades when medium and low impact news hits It will release pending order both directions few min prior to news impact And will have certain risk management strategy attached Example If Monday and Tuesday news successful clears profits It will reduce risk for next news events until new week starts each week message on tg: Dstatewealthtrading NOTE: 4 YAERS OF EXPERIENCE UPWORD, YOU MUST BE A

프로젝트 정보

예산
30+ USD
개발자에게
27 USD