Add stoploss to ea0130

Specification

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

Responded

1
Developer 1
Rating
(22)
Projects
21
10%
Arbitration
4
25% / 75%
Overdue
0
Free
2
Developer 2
Rating
(633)
Projects
1001
47%
Arbitration
33
36% / 36%
Overdue
98
10%
Working
Published: 6 codes
3
Developer 3
Rating
(1)
Projects
1
0%
Arbitration
1
0% / 100%
Overdue
1
100%
Free
4
Developer 4
Rating
(37)
Projects
59
27%
Arbitration
26
19% / 54%
Overdue
10
17%
Working
Published: 1 code
5
Developer 5
Rating
(72)
Projects
80
10%
Arbitration
38
8% / 58%
Overdue
6
8%
Free
6
Developer 6
Rating
(279)
Projects
341
37%
Arbitration
6
50% / 17%
Overdue
7
2%
Free
Published: 5 codes
7
Developer 7
Rating
(47)
Projects
67
37%
Arbitration
5
40% / 40%
Overdue
1
1%
Free
8
Developer 8
Rating
(156)
Projects
198
59%
Arbitration
10
80% / 0%
Overdue
0
Working
Published: 1 code
9
Developer 9
Rating
(4)
Projects
4
100%
Arbitration
0
Overdue
0
Free
10
Developer 10
Rating
(17)
Projects
22
36%
Arbitration
5
0% / 100%
Overdue
4
18%
Free
11
Developer 11
Rating
(43)
Projects
66
12%
Arbitration
12
58% / 42%
Overdue
1
2%
Free
12
Developer 12
Rating
Projects
0
0%
Arbitration
0
Overdue
0
Free
13
Developer 13
Rating
(15)
Projects
19
16%
Arbitration
5
40% / 40%
Overdue
0
Free
14
Developer 14
Rating
Projects
1
0%
Arbitration
0
Overdue
0
Free
15
Developer 15
Rating
(574)
Projects
945
47%
Arbitration
309
58% / 27%
Overdue
125
13%
Free
16
Developer 16
Rating
(69)
Projects
146
34%
Arbitration
13
8% / 62%
Overdue
26
18%
Free
Published: 6 codes
17
Developer 17
Rating
(174)
Projects
233
61%
Arbitration
3
33% / 33%
Overdue
6
3%
Free
Published: 1 code
Similar orders
Hello, I am looking for someone who can help me to build a MT4/MT5 forex EA, by analyzing the trading history. You are responsible to find out trading logic behind the EA and Build a new EA that accurately replicates the existing strategy. I need someone who has proven previous experience to build a new EA by reverse engineering. Thanks
I am looking for an experienced MT4/MT5 developer to analyze my trading history and replicate the strategy in a new Expert Advisor (EA). The developer must have proven experience in reverse engineering strategies, analyzing trading data, and developing EAs across various trading methodologies. A deep understanding of XAUUDS and BTCUSD behavior, as well as chart analysis, is essential. Please note that we do not have
Title: MT5 Forex Trading Robot Development I need a MetaTrader 5 (MT5) Expert Advisor (EA) for automated Forex trading. Requirements: 1. The robot must be fully automated and capable of opening and closing trades without manual intervention. 2. Compatible with MetaTrader 5 (MT5). 3. Adjustable lot size, Stop Loss, and Take Profit settings. 4. Built-in risk management based on account balance. 5. Ability to trade
Risk management EA 30 - 200 USD
Looking to develop risk management EA for personal use probably commercially in the future. I want the EA to have a display panel with 0.1, 0.2, 0.5,1,2,3 percent risk management button. I also want BE, partial closure of 0.25,0.5,0.75 and full closure panel on both profit and loss. I’ll also like to include trailing stop, 2 trades max per day and BE+spread option. I’ll be attaching the image for a guidance on what
Sierra Chart Alerts to MT5 via Webhook (Alert Manager File Version) Objective: Create a Custom Study (ACSIL / C++) that monitors alerts from the Alert Manager file and forwards any valid alert directly to MT5 via an HTTP POST (Webhook) in JSON format. Additional Note: The study should allow adding any modifications in the future and provide clear insights into the alert points in Sierra Chart. 1. Data Flow Diagram
Ea.Mix 30+ USD
I am in need of a good scalping bot for gold or any currency pair. If you have one that is working, reach out. You must be able to provide a trial version so I can test the bot myself
A bot takes trades every few seconds until hit the profit with the same lots , i am attaching a picture as well. If anyone can do that please contact me i will give the account details
MT5 Expert Advisor Development Project Overview I am looking for an experienced MQL5 developer to build a custom MetaTrader 5 Expert Advisor based on a grid-cycle trading framework. This is not a standard grid EA . The system combines: Session-based trade initiation Multi-filter signal generation Dynamic grid management Advanced basket management State-machine-driven trade lifecycle management Dynamic take-profit
I have a MT5 Hull MTF Indicator that I like. I would like someone to add: 1) Time of day function (with start time and end time) so that it does not send messages during my night time. Default Start=0900 Default End=2300 2) Add to the Message (sound and email): so that it is Symbol+Buy-Or-Sell+Ask-OrBid Price+TimeFrame1 "/" TimeFrame2 I will send the indicator to the developer. Thank you
i have built a indicator on trading view which is veryt good, its based on liquidity sweeps on stop losses. im looking for an someone with experience in trading and indicators that has worked on similar strategy indicators. it already wins lots of very good trades im looking to tighten up on uneccesary trades it may send to clean it up as i currently am testing it out running to signal channel and want it the best /

Project information

Budget
30+ USD