Add stoploss to ea0130

Tarea técnica

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

Han respondido

1
Desarrollador 1
Evaluación
(22)
Proyectos
21
10%
Arbitraje
4
25% / 75%
Caducado
0
Libre
2
Desarrollador 2
Evaluación
(623)
Proyectos
980
47%
Arbitraje
32
38% / 34%
Caducado
96
10%
Trabaja
Ha publicado: 6 ejemplos
3
Desarrollador 3
Evaluación
(1)
Proyectos
1
0%
Arbitraje
1
0% / 100%
Caducado
1
100%
Libre
4
Desarrollador 4
Evaluación
(37)
Proyectos
59
27%
Arbitraje
26
19% / 54%
Caducado
10
17%
Trabaja
Ha publicado: 1 ejemplo
5
Desarrollador 5
Evaluación
(72)
Proyectos
80
10%
Arbitraje
38
8% / 58%
Caducado
6
8%
Libre
6
Desarrollador 6
Evaluación
(278)
Proyectos
340
37%
Arbitraje
6
50% / 17%
Caducado
7
2%
Libre
Ha publicado: 5 ejemplos
7
Desarrollador 7
Evaluación
(47)
Proyectos
67
37%
Arbitraje
5
40% / 40%
Caducado
1
1%
Libre
8
Desarrollador 8
Evaluación
(152)
Proyectos
190
57%
Arbitraje
10
80% / 0%
Caducado
0
Libre
Ha publicado: 1 ejemplo
9
Desarrollador 9
Evaluación
(4)
Proyectos
4
100%
Arbitraje
0
Caducado
0
Libre
10
Desarrollador 10
Evaluación
(17)
Proyectos
22
36%
Arbitraje
5
0% / 100%
Caducado
4
18%
Libre
11
Desarrollador 11
Evaluación
(43)
Proyectos
66
12%
Arbitraje
12
58% / 42%
Caducado
1
2%
Libre
12
Desarrollador 12
Evaluación
Proyectos
0
0%
Arbitraje
0
Caducado
0
Libre
13
Desarrollador 13
Evaluación
(15)
Proyectos
19
16%
Arbitraje
5
40% / 40%
Caducado
0
Libre
14
Desarrollador 14
Evaluación
Proyectos
1
0%
Arbitraje
0
Caducado
0
Libre
15
Desarrollador 15
Evaluación
(574)
Proyectos
945
47%
Arbitraje
309
58% / 27%
Caducado
125
13%
Libre
16
Desarrollador 16
Evaluación
(69)
Proyectos
146
34%
Arbitraje
13
8% / 62%
Caducado
26
18%
Libre
Ha publicado: 6 ejemplos
17
Desarrollador 17
Evaluación
(170)
Proyectos
228
60%
Arbitraje
3
33% / 33%
Caducado
6
3%
Libre
Ha publicado: 1 ejemplo
Solicitudes similares
1. Goal I want a MetaTrader 5 Expert Advisor that trades a simple Supertrend trend‑following idea, but with professional‑grade risk management and filters. It should be robust enough for real money on instruments like XAUUSD and GBP pairs, using small, consistent risk per trade rather than martingale or grid. 2. Strategy Logic Indicators (I will supply the .mq5 files if needed): Supertrend (ATR‑based), with
Hi developers, I need someone to help me create a simple EA with my indicators and trading plan... I will give you all parameters and you help me create... 2 moving averages, one candle pattern
Please a need a very good expert for this jou I want to create 2 robot one a trade manager Perfect — here’s a clean, professional order description you can post directly to an EA freelancer (MQL5). I’ve written it so it’s clear, serious, and attractive to skilled developers 👌 MQL5 Trade Manager EA – Development Request I am looking for an experienced MQL5 developer to build a robust Trade Manager Expert Advisor for
Henryy999 30 - 3000 USD
The Ai robot must help me with forex and I don't have money soon can the Ai robot give me some money and I will pay it back if the Ai robot does a good job making me rich
Project Title: MT5 Algo Trading EA (Single Strategy + License Panel + Ownership + Manual Trade) --- Project Description I am looking for an experienced MT5 (MQL5) developer to create a clean, stable and professional Algo Trading EA for my company and future clients. This is a long-term business project, not a one-time personal EA. --- 1. Strategy Requirements - Only 1 single trading strategy - No martingale - No grid
I am looking for an experienced StrategyQuant X (SQX) developer to build a reusable trading template , not a single strategy. ⚠️ Please do NOT apply unless you actively use StrategyQuant X and have access to it. This project cannot be completed without SQX. 1. Session and Time Filters Trading restricted to fixed GMT sessions per index Sessions must convert correctly to broker server time and remain correct through
Is there someone who coded the PipJuice indicator? Here is the link: https://www.pipjuice.io/ Unfortunately, I don‘t have access to the indicator or the code. If someone have it please send me some screenshots
Strategy Development: Suggest a high-probability trading strategy based on Technical Analysis (using indicators like RSI, MACD, or Price Action). Risk Management: Explain how to calculate position sizing so I don't lose more than 1-2% of my capital per trade. Market Analysis: Teach me how to identify Support and Resistance levels and how to spot a trend reversal. Psychology: Give me 5 golden rules to maintain
A Grid EA with a hedge that open trades on a percentage based on whats is opened on the other side, closes losing trades with current profits made and utilizes a grid trading strategy combined with hedging technique to mitigate risk and potentially lock in profits. It involves placing buy and sell orders at predetermined price intervals, forming a grid. When a trade within the grid moves against the initial
MQL5 Expert Advisor Development (MT5) I need a professional MQL5 developer to create a custom Expert Advisor (EA) for MetaTrader 5 with high accuracy, low drawdown, and fast execution . 🔹 Strategy Requirements: Timeframe: Scalping-friendly (M1 / M5) Indicators Used: EMA 9 EMA 12 EMA 21 VWAP (as a trend filter) RSI (for trade confirmation) 🔹 Trade Logic: Buy and Sell entries based on EMA crossover + VWAP direction

Información sobre el proyecto

Presupuesto
30+ USD