Add stoploss to ea0130

Specifiche

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

Con risposta

1
Sviluppatore 1
Valutazioni
(21)
Progetti
20
10%
Arbitraggio
2
50% / 50%
In ritardo
0
In elaborazione
2
Sviluppatore 2
Valutazioni
(599)
Progetti
932
46%
Arbitraggio
31
39% / 29%
In ritardo
93
10%
Gratuito
3
Sviluppatore 3
Valutazioni
(1)
Progetti
1
0%
Arbitraggio
0
In ritardo
1
100%
Gratuito
4
Sviluppatore 4
Valutazioni
(37)
Progetti
59
27%
Arbitraggio
25
20% / 52%
In ritardo
10
17%
In elaborazione
5
Sviluppatore 5
Valutazioni
(72)
Progetti
80
10%
Arbitraggio
36
8% / 53%
In ritardo
6
8%
In elaborazione
6
Sviluppatore 6
Valutazioni
(260)
Progetti
317
37%
Arbitraggio
6
50% / 17%
In ritardo
7
2%
Gratuito
7
Sviluppatore 7
Valutazioni
(20)
Progetti
26
46%
Arbitraggio
0
In ritardo
0
In elaborazione
8
Sviluppatore 8
Valutazioni
(98)
Progetti
120
39%
Arbitraggio
9
89% / 0%
In ritardo
0
In elaborazione
9
Sviluppatore 9
Valutazioni
(4)
Progetti
4
100%
Arbitraggio
0
In ritardo
0
Gratuito
10
Sviluppatore 10
Valutazioni
(17)
Progetti
22
36%
Arbitraggio
2
0% / 100%
In ritardo
4
18%
Gratuito
11
Sviluppatore 11
Valutazioni
(42)
Progetti
62
8%
Arbitraggio
12
58% / 42%
In ritardo
1
2%
Gratuito
12
Sviluppatore 12
Valutazioni
Progetti
0
0%
Arbitraggio
0
In ritardo
0
Gratuito
13
Sviluppatore 13
Valutazioni
(5)
Progetti
6
17%
Arbitraggio
0
In ritardo
0
Gratuito
14
Sviluppatore 14
Valutazioni
Progetti
1
0%
Arbitraggio
0
In ritardo
0
Gratuito
15
Sviluppatore 15
Valutazioni
(564)
Progetti
933
47%
Arbitraggio
302
59% / 25%
In ritardo
125
13%
Caricato
16
Sviluppatore 16
Valutazioni
(66)
Progetti
143
34%
Arbitraggio
10
10% / 60%
In ritardo
26
18%
Gratuito
17
Sviluppatore 17
Valutazioni
(130)
Progetti
186
54%
Arbitraggio
3
33% / 33%
In ritardo
6
3%
Gratuito
Ordini simili
Mobile robot 50 - 100 USD
I want a profitable scalping EA robot for mt5 and mobile phones (licence key should be provided).the video link attached below indicates how the EA robot should operate it.it analyses the market before taking trades and it trades candle to candle .also coding samples are provided on the video .it should be applicable to all timeframes.it should trade indices(Nas100,US30,S&p500,GER30,)
Martingale EA for MT5 30 - 100 USD
Criteria: Only one trade at a time. Cannot open another trade if one is running Trade on EURUSD only, once job is completed I will be happy to schedule more for other pairs You choose entry strategy and criteria win rate must be above 50% in long term backtest of EURUSD Every trade has got TP and SL Trades to last about a day, few trades a week, at least 10 pips gain per trade, so that it can be launched on normal
I have a indicator, mql file. The signals are seen below on a EURNZD H1 chart. Very important to get accurate entries. The signal to trade is the first tic after the the indicator signal paints. I've tried to demonstrate that below. Other than that the EA will have a lot size escalation, an on-screen pip counter, a button to stop taking new trades, SL/TP, and magic number. I would like the indicator to be within the
I would like to create an EA based on the Shved Supply and Demand indicator. you can find the Shved Supply and Demand v1.7 indicator in the following link https://www.mql5.com/en/code/29395 NB: Checks the trading robot must pass before publication in the Market ( https://www.mql5.com/en/articles/2555 ) MQ5 file to be provided
I want grate robot for making profits that know when to start a good trade and close a trade and must be active all time to avoid lost of money
Hi Guys, I am looking to someone that can generate an indicator for MT4 as explained below. Basically I would need that the indicator point out the price that will close my position in stop out/margin call. The indicator should pick automatically the level of trade out for the broker (which can be different from a broker to another broker) It should write (ideally on the bottom on the left) the following information
Mbeje fx 50+ USD
I like to own my robot that why I want to build my own.i like to be a best to every robot ever in the life to be have more money
I need an MT5 EA that can do the following: I have to give the EA a price in advance, when the price is reached the EA has to automatically place a buy stop or sell stop order 0.5 pips below or above the price. Is this possible
Good day, I want someone to help me create a universal news filter with on/off switch, with start and end settings, and drawdown control with magic number of EAs, etc. Thanks
Hello, I am looking for a professional programmer to optimize my existing EA integrating it with ChatGPT to analyze currencies using various methods to make the right trading decisions. i want it to be an EA that can be trusted to carry trade with the help of chat gpt and also have a very low drawdown

Informazioni sul progetto

Budget
30+ USD
Per lo sviluppatore
27 USD